<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../plugins/layui/css/layui.css?v=${.Config.basic.version}" media="all">
    <link rel="stylesheet" href="../plugins/layui/css/style.css?v=${.Config.basic.version}" media="all">

    <link rel="stylesheet" href="../layuiadmin/style/admin.css?v=${.Config.basic.version}" media="all">
    <link rel="stylesheet" href="../plugins/zTree/css/metroStyle/metroStyle.css?v=${.Config.basic.version}">
    <link rel="stylesheet" href="../plugins/zTree/css/metroStyle/ext.css?v=${.Config.basic.version}">
    <link rel="stylesheet" href="../css/atlantis.css?v=${.Config.basic.version}">
    <link rel="stylesheet" href="../plugins/toastr/toastr.min.css?v=${.Config.basic.version}">
    <link rel="stylesheet" href="//at.alicdn.com/t/c/font_3564966_a6tt4yhnzge.css" media="all">
    <style>


        .layui-form-item .layui-input-inline {
            float: left;
            width: 100px;
            margin-right: 10px;
        }
        .layui-form-item {
            margin-bottom: 2px;
        }

        .header-panel {
            display: flex;
            width: 100%;
            height: 4vh;
        }

        .header-panel .layui-input, .layui-select, .layui-textarea {
            height: 34px;
            line-height: 34px;
            /* border-width: 1px; */
            /* border-style: solid; */
            /* background-color: #0a1434; */
            color: #333;
            border-radius: 5px;
            border: 0px solid #6c7492;
            /*text-align: right;*/
            text-align: center;
            font-size: 18px;
        }

        .header-panel .layui-form-select dl dd {
            cursor: pointer;
            text-align: center;
        }

        .content {
            padding: 2px;
            position: absolute;
            top: 4vh;
            bottom: 0;
            left: 0;
            right: 0;
            right: 0;
            display: flex;
        }
        .top-content{
            /*display: flex;*/
            width: 100%;
            /*height: 20%;*/
        }
        .bottom-content{
            display: flex;
            width: 100%;
            /*height: 80%;*/
            height: calc(100% - 120px);
        }
        .left-content {
            display: flex;
            width: 25%;
            height: 100%;
        }
        .right-content {
            display: flex;
            width: 75%;
            height: 100%;
        }
        .panel-container {
            display: flex;
            flex: 1 1 0;
            flex-grow: 1;
            flex-shrink: 1;
            flex-basis: 0px;
            flex-direction: column;
            height: 100%;
            position: relative;
            width: 100%;
        }
        .mode-panel {
            height: 50%;
            border-radius: 10px;
            margin-left: 10px;
        }

        .sum-model{
            border-radius: 10px;
            margin-left: 10px;
        }
        .feed-panel{
            height: 100%;
            margin-left: 10px;
            margin-right: 10px;
        }
        .house-panel{
            height: 50%;
            margin-left: 10px;
            margin-right: 10px;
        }

        .bg-panel{
            background-color: #f4f4f4;
            border: 1px solid #f4f4f4;
            border-radius: 3px;
            box-shadow: none;
            box-shadow: 1px 1px 2px 1px #B4B4B4;
            position: relative;
            /* border-radius: 10px; */
        }

        .card-category {
            margin-top: 8px;
            font-size: 14px;
            color: #555;
            margin-bottom: 0;
            word-break: normal;
            font-weight: bold;
        }

        .chart-panel{
            height: calc((100% - 200px)/2);
        }

        .panel-header{
            height: 2rem;
            margin-bottom: 0.1rem;
            position: relative;
        }
        .panel-header{
            height: 2rem;
            margin-bottom: 0.1rem;
            position: relative;
        }
        .panel-title{
            font-size: 1rem;
            color: #666;
            line-height: 2rem;
            /*font-weight: bold;*/
            position: relative;
            z-index: 20;
            margin-left: 1rem;
        }
        .panel-content{
            height: calc(100% - 2rem);
        }


        .house {
            background-color: #0a1434;
            height: 80%;
            overflow: hidden;
            cursor: pointer;
            padding: 10px;
            margin: 10px;
            /*opacity: 0.5;*/
            /*!*height: 100%;*!*/
            /*background: rgb(15, 12, 12,100) url("/img/house.png") no-repeat scroll center center;*/
            /*background-position-x: center;*/
            /*background-position-y: center;*/
            /*background-size: auto;*/
            /*display: block;*/
            /*background-position: 50% 0%;*/
            /*background-size: 40%;*/
        }

        .house-content{
            height: 90%;
        }


        .panel-rela {
            position: relative;
            z-index: 20;
            width: 100%;
            height: 100%;
        }
        .p15 {
            padding: 0.15rem;
        }
        .layui-elem-quote {
            margin-bottom: 10px;
            /*margin-top: 10px;*/
            padding: 10px;
            line-height: 5px;
            border-left: 2px solid #00c7d9;
            border-radius: 0 2px 2px 0;
            background-color: transparent;
            color: #eeeeee;
            font-size: 0.9rem;
        }
        .house-img{
            height: 50%;
            overflow: hidden;
            cursor: pointer;
            /*padding: 10px;*/
            /*margin: 10px;*/
            /*opacity: 0.5;*/
            background: url("../img/house.png") no-repeat scroll center center;
            background-position-x: center;
            background-position-y: center;
            background-size: auto;
            background-position-x: center;
            background-position-y: center;
            background-size: auto;
            display: block;
            background-position: 50% 0%;
            background-size: 50%;
            /*top: -20%;*/
            position: relative;
        }
        .drop {
            /*width: 100%;*/
            height: auto;
            /*background: rgba(31,48,102,.6);*/
            position: relative;
            /*padding-left: 10px;*/
            /*padding-right: 10px;*/
            padding: 10px;
            /*top: 35%;*/
            /*left: 0;*/
            /*margin-left: -65px;*/
        }
        .drop .tit {
            font-size: 0.9rem;
            color: #fff;
            text-align: center;
        }
        .drop .box {
            margin-top: 5px;
        }
        .drop p {
            font-size: 0.8rem;
            color: #a3bed9;
            line-height: 1rem;
        }
        .drop p em {
            float: right;
            font-style:normal;
        }
        .drop .ico {
            width: 9px;
            height: 9px;
            background-repeat: no-repeat;
            background-position: center;
            background-size: contain;
            display: block;
            position: absolute;
        }
        .drop .ico_1 {
            background-image: url("../img/top_left.png");
            top: 0;
            left: 0;
        }
        .drop .ico_2 {
            background-image: url("../img/top_right.png");
            top: 0;
            right: 0;
        }
        .drop .ico_3 {
            background-image: url("../img/bottom_left.png");
            bottom: 0;
            left: 0;
        }
        .drop .ico_4 {
            background-image: url("../img/bottom_right.png");
            bottom: 0;
            right: 0;
        }

        .toolbar{
            padding-left: 2vh;
        }


        .toolbar .text{
            cursor: pointer;
            line-height: 4vh;
            font-size: 16px;
        }
        .toolbar .text:hover{
            color: #4958b9;
        }
        [v-cloak]{
            display: none;
        }
        .panel-under-title {
            height: calc(100% - 20px);
        }

        .numbers{
            width: 100%;
            height: 100%;
            font-size: 2.2em;
            min-height: 64px;
        }
        .card-stats .col-stats {
            align-items: center;
            display: flex;
            padding-left: 1.1rem;
        }

        .layui-table-view .layui-table td, .layui-table-view .layui-table th {
            padding: 5px 0;
            border-top: 1px solid #404453;
            border-left: 1px solid #404453;
            border-bottom: 1px solid #404453;
            border-right: 1px solid #404453;
        }
        .layui-btn {
            background-color: #37384d;
        }
    </style>
</head>

<body >

    <div class="header-panel">
        <!--<span class="layui-breadcrumb">
          <a id="farmname" href="javascript:void(0);" onclick="goFarm();">养殖场</a>
          <a><cite>栏舍</cite></a>
        </span>-->
        <div class="toolbar">
            <i class="layui-icon layui-icon-left icon"></i>
            <span class="text" id="farmname" href="javascript:void(0);" onclick="goFarm();"></span>
        </div>


        <form class="layui-form" lay-filter="form_select" style="margin-left: 40%;">
            <select  name="house" lay-filter="house" lay-verify="required" lay-search="" style="width: 100%;" >
                <option value=""></option>
            </select>
        </form>


    </div>

    <div class="content scroll-none">
        <div class="left-content">
            <div class="panel-container">
                <div class="sum-model ">
                    <div class="layui-row layui-col-space10 sum-info" v-cloak>
                        <div class="layui-col-md6">
                            <div class="card card-stats bg-panel card-round">
                                <div class="card-body">
                                    <div class="row">
                                        <div class="layui-col-md3">
                                            <div class="icon-big text-center">
                                                <i class="iconfont icon-pig layui-icon-lg "></i>
                                            </div>
                                        </div>
                                        <div class="layui-col-md9 col-stats">
                                            <div class="numbers">
                                                <p class="card-category  layui-text-sm">猪只个数</p>
                                                <div >
                                                    <span class="layui-text-md layui-text-green-light">{{pig_num_total}} </span>
                                                    <span class="layui-text-xs layui-text-mute"> 头</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="card card-stats bg-panel card-round">
                                <div class="card-body">
                                    <div class="row">
                                        <div class="layui-col-md3">
                                            <div class="icon-big text-center">
                                                <i class="iconfont icon-5siliao layui-icon-lg "></i>
                                            </div>
                                        </div>
                                        <div class="layui-col-md9 col-stats">
                                            <div class="numbers">
                                                <p class="card-category  layui-text-sm">今日下料</p>
                                                <div >
                                                    <span class="layui-text-md layui-text-green-light">{{today_feed}} </span>
                                                    <span class="layui-text-xs layui-text-mute"> kg</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="card card-stats bg-panel card-round">
                                <div class="card-body">
                                    <div class="row">
                                        <div class="layui-col-md3">
                                            <div class="icon-big text-center">
                                                <i class="iconfont icon-shebeizhuangtai layui-icon-lg"></i>
                                            </div>
                                        </div>
                                        <div class="layui-col-md9 col-stats">
                                            <div class="numbers">
                                                <p class="card-category  layui-text-sm">在线/总设备</p>
                                                <div ><span class="layui-text-md layui-text-green-light" v-bind:class="{'layui-text-blue': online_num>0 && offline_num==0,'layui-text-red': offline_num>0}">{{online_num}}/{{offline_num+online_num}}</span> <span class="layui-text-xs layui-text-mute"></span></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="card card-stats bg-panel card-round">
                                <div class="card-body">
                                    <div class="row">
                                        <div class="layui-col-md3">
                                            <div class="icon-big text-center">
                                                <i class="layui-icon layui-icon-notice layui-icon-lg"></i>
                                            </div>
                                        </div>
                                        <div class="layui-col-md9 col-stats">
                                            <div class="numbers">
                                                <p class="card-category  layui-text-sm">告警设备</p>
                                                <div ><span class="layui-text-md " v-bind:class="{'layui-text-mute': alarm_device_num==0,'layui-text-red': alarm_device_num!=0}">{{alarm_device_num}} </span> <span class="layui-text-xs layui-text-mute"> 个</span></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="mode-panel bg-panel chart-panel" style="margin-top: 10px;">
                    <div class="panel-header">
                        <span class="panel-title">单头平均采食</span>
                    </div>
                    <div id="chart1" class="panel-under-title">
                    </div>
                </div>
                <div class="mode-panel bg-panel chart-panel" style="margin-top: 10px;">
                    <div class="panel-header">
                        <span class="panel-title">日采食总量</span>
                    </div>
                    <div id="chart2" class="panel-under-title">
                    </div>
                </div>
            </div>
        </div>
        <div class="right-content">
            <div class="panel-container">
                <div class="feed-panel bg-panel">
                    <div class="panel-header">
                        <span class="panel-title"></span>
                    </div>
                    <div class="panel-content canvas_contain">
                        <canvas style="height: 70px;width: 500px; " width="500" height="70" ondragstart="return false;"  class=" center-block" id="canvas" >
                        </canvas>
                    </div>
                </div>



            </div>
        </div>
    </div>


    <script src="../plugins/layui/layui.js"></script>
    <script src="../plugins/layui/xm-select-v1.2.4.js"></script>
    <script src="../plugins/jquery/jquery-3.6.0.js?v=${.Config.basic.version}"></script>
    <script src="../plugins/vue/vue.min.js"></script>
    <!-- <script src="/plugins/echart/echarts.min.js"></script> -->
    <script src="../plugins/echart/echarts-4.8.min.js?v=${.Config.basic.version}"></script>
    <script src="../plugins/zTree/js/jquery.ztree.core.min.js?v=${.Config.basic.version}"></script>
    <script src="../plugins/zTree/js/jquery.ztree.excheck.js?v=${.Config.basic.version}"></script>
    <script src="../plugins/zTree/js/jquery.ztree.exedit.js?v=${.Config.basic.version}"></script>
    <script src="../plugins/jtopo/jtopo_fixbug.js"></script>
    <script src="../plugins/jquery.slimscroll.min.js"></script>
    <script src="../plugins/moment.min.js"></script>
    <script src="../plugins/toastr/toastr.min.js"></script>
    <script src="../js/utils.js?v=${.Config.basic.version}"></script>
    <script src="../js/func.js?v=${.Config.basic.version}"></script>
    <script>
        var lay_index=null;
        var zTree=null;
        var table=null;
        var laydate=null;
        var form=null;
        var element=null;
        //var transfer=null;
        var actions=null;
        var token = window.localStorage.getItem("token");
        var user_info=JSON.parse(window.localStorage.getItem("user_info"));
        var func_url="farm_status";
        var farms=null;
        var houses=null;
        var cur_farm = null;
        var cur_farm_id =null;
        var cur_house = null;
        var cur_house_id =null;
        var max_row=0;
        var max_col=0;
        var request = getRequest();
        console.info(request);
        if(request){
            if(request.farmid){
                cur_farm_id = request.farmid;
                cur_house_id = request.id;
            }
        }

        var canvas=null;
        var stage=null;
        var scene=null;
        var all_nodes=[];
        var ActiveNodeParas=[];
        var ActiveNodeStates=[];
        var currentNode=null;

        var begin = moment().add(-1, 'months').format('YYYY-MM-DD');
        var end = moment().add(-1, 'days').format('YYYY-MM-DD');

        const maskColor = "rgba(0, 0, 0, 0.2)";
        const redColor = "#FF3366";
        const greenColor = "#009900";
        const blueColor = "#009900";
        const grayColor = "#3e4144";
        const cyanColor = "#6ed0e0";
        const waterColor = "#4168ff";
        const lightGreenColor = "#429c5e";
        const lightOrangeColor = "#f47011";
        const lightOrangeColor1 = "#3c7cff";
        const lightOrangeColor2 = "#3c7cff";
        const co2Color = "#91c7ae";
        const gasColor = "#61a0a8";
        const titleColor = "#8f97b3";

        var chart=null;

        var chart1 =null;
        var chart2 =null;
        var chart1_options = {
            //#3c7cff
            //backgroundColor:'#3c7cff',
            legend: {
                show:true,
                x:'center',
                y:'10',
                icon: 'stack',
                itemWidth:10,
                itemHeight:10,
                textStyle: {
                    fontSize: 11,
                    color: '#666'
                },
                data:['采食量(kg)',"饮水量(L)"]
            },
            toolbox: {
                show: true,
                right:10,
                itemSize:12,
                iconStyle:{
                    //color:'#ffffff',
                },
                feature: {
                    saveAsImage: {
                        title: '保存图片',
                    },
                    myExport: {
                        show: true,
                        title: '导出Excel',
                        icon: 'path://M832 1024H192a64 64 0 0 1-64-64V64a64 64 0 0 1 64-64h448v3.968L896 256v704a64 64 0 0 1-64 64zM640 127.488V256h129.472L640 127.488zM832 320h-192a64 64 0 0 1-64-64V64H192v896h640V320z',
                        onclick: function (){
                        }
                    }
                }
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    lineStyle: {
                        color: {
                            type: 'linear',
                            x: 0,
                            y: 0,
                            x2: 0,
                            y2: 1,
                            colorStops: [{
                                offset: 0,
                                color: 'rgba(0, 255, 233,0)'
                            }, {
                                offset: 0.5,
                                color: 'rgba(255, 255, 255,1)',
                            }, {
                                offset: 1,
                                color: 'rgba(0, 255, 233,0)'
                            }],
                            global: false
                        }
                    },
                }
            },
            grid: {
                top: '15%',
                left: '5%',
                right: '5%',
                bottom: '15%',
                containLabel: true
            },
            xAxis: [{
                type: 'category',
                axisLine: {
                    show: true
                },
                splitArea: {
                    // show: true,
                    color: '#f00',
                    lineStyle: {
                        color: '#f00'
                    },
                },
                axisLabel: {
                    color: titleColor
                },
                splitLine: {
                    show: false
                },
                boundaryGap: false,
                //data: ['A', 'B', 'C', 'D', 'E', 'F'],

            }],
            yAxis: [{
                type: 'value',
                min: 0,
                splitLine: {
                    show: false,
                    lineStyle: {
                        color: 'rgba(255,255,255,0.1)'
                    }
                },
                axisLine: {
                    show: false,
                },
                axisLabel: {
                    show: true,
                    margin: 20,
                    textStyle: {
                        color: titleColor,

                    },
                },
                axisTick: {
                    show: true,
                },
            },{
                type: 'value',
                min: 0,
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: 'rgba(255,255,255,0.1)'
                    }
                },
                axisLine: {
                    show: false,
                },
                axisLabel: {
                    show: true,
                    margin: 20,
                    textStyle: {
                        color: titleColor,

                    },
                },
                axisTick: {
                    show: true,
                },
            }],
            series: [{
                name: '采食量(kg)',
                type: 'line',
                //symbolSize: 3,
                smooth: true, //是否平滑
                showSymbol: true,
                // symbol: 'image://./static/images/guang-circle.png',
                //symbol: 'none',
                yAxisIndex: 0,

                areaStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: lightOrangeColor
                        }, {
                            offset: 0.8,
                            color: 'rgba(255,255,255,0)'
                        }], false),
                        // shadowColor: 'rgba(255,255,255, 0.1)',
                        shadowBlur: 10,
                        opacity:0.3,
                    }
                },
                itemStyle: {
                    normal: {
                        color: lightOrangeColor,
                        lineStyle: {
                            width: 1,
                            type: 'solid' //'dotted'虚线 'solid'实线
                        },
                        borderColor: lightOrangeColor, //图形的描边颜色。支持的格式同 color
                        //borderWidth: 8 ,//描边线宽。为 0 时无描边。[ default: 0 ]
                        barBorderRadius: 0,
                        label: {
                            show: false,
                        },
                        opacity:0.5,
                    }
                },
                tooltip: {
                    show: true
                }
            }
                ,{
                    name: '饮水量(L)',
                    type: 'line',
                    smooth: true, //是否平滑
                    showSymbol: true,
                    yAxisIndex: 1,
                    areaStyle: {
                        normal: {
                            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                offset: 0,
                                color: '#00c7d9'
                            }, {
                                offset: 0.8,
                                color: 'rgba(255,255,255,0)'
                            }], false),
                            // shadowColor: 'rgba(255,255,255, 0.1)',
                            shadowBlur: 10,
                            opacity:0.3,
                        }
                    },
                    itemStyle: {
                        normal: {
                            color: '#00c7d9',
                            lineStyle: {
                                width: 1,
                                type: 'solid' //'dotted'虚线 'solid'实线
                            },
                            borderColor: '#00c7d9', //图形的描边颜色。支持的格式同 color
                            //borderWidth: 8 ,//描边线宽。为 0 时无描边。[ default: 0 ]
                            barBorderRadius: 0,
                            label: {
                                show: false,
                            },
                            opacity:0.5,
                        }
                    },
                    tooltip: {
                        show: true
                    }
                }
            ]
        };
        var chart2_options = {
            //backgroundColor:'#3c7cff',
            legend: {
                show:true,
                x:'center',
                y:'10',
                icon: 'stack',
                itemWidth:10,
                itemHeight:10,
                textStyle: {
                    fontSize: 11,
                    color: '#666'
                },
                data:['采食量(kg)','饮水量(L)'],
            },
            toolbox: {
                show: true,
                right:10,
                itemSize:12,
                iconStyle:{
                    //color:'#ffffff',
                },
                feature: {
                    saveAsImage: {
                        title: '保存图片',
                    },
                    myExport: {
                        show: true,
                        title: '导出Excel',
                        icon: 'path://M832 1024H192a64 64 0 0 1-64-64V64a64 64 0 0 1 64-64h448v3.968L896 256v704a64 64 0 0 1-64 64zM640 127.488V256h129.472L640 127.488zM832 320h-192a64 64 0 0 1-64-64V64H192v896h640V320z',
                        onclick: function (){
                        }
                    }
                }
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'shadow'
                }
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '15%',
                containLabel: true
            },
            xAxis: [
                {
                    type: 'category',
                    boundaryGap: true,
                    data: [],
                    splitLine: {
                        show: true,
                        lineStyle: {
                            color: 'rgba(255,255,255,0.05)'
                        }
                    },
                    axisLabel: {
                        textStyle: {
                            color: titleColor
                        },
                        //alignWithLabel: true,
                        //interval: 0,
                        //rotate: '15'
                    }
                }
            ],
            yAxis: [
                {
                    type: 'value',
                    //splitNumber:3,
                    splitLine: {
                        show: true,
                        lineStyle: {
                            color: 'rgba(255,255,255,0.05)'
                        }
                    },
                    axisLabel: {
                        textStyle: {
                            color:titleColor
                        }
                    },
                }
            ],
            series: [
                {
                    name: '采食量(kg)',
                    type: 'bar',
                    //barWidth: '10px',
                    //yAxisIndex: 0,
                    barMaxWidth: '10px',
                    data: [],
                    itemStyle: {
                        normal: {
                            color: lightOrangeColor1,
                            barBorderRadius: [30, 30, 30, 30],
                            shadowColor: '#f29725',
                            shadowBlur: 4,
                        }
                    },
                },
                {
                    name: '饮水量(L)',
                    type: 'bar',
                    //barWidth: '10px',
                    //yAxisIndex: 1,
                    barMaxWidth: '10px',
                    data: [],
                    itemStyle: {
                        normal: {
                            color: waterColor,
                            barBorderRadius: [30, 30, 30, 30],
                            shadowColor: blueColor,
                            shadowBlur: 4,
                        }
                    },
                }
            ]
        };



        var trans_bg="10,20,52";
        var offline_color="100,100,100";
        var disable_color="0,0,0";
        var orange_color="255,222,173";
        var blue_color="0,255,255";
        var nanmu_orange_bg="242,145,20";
        var nanmu_blue_bg="0,161,186";
        var offline_bg="100,100,100";
        var white_color = "255,255,255";
        var gray_color = "200,200,200";
        var red_color = "255,0,0";
        var nanmu_orange = "#F29114";
        var nanmu_blue = "#00A1BA";
        var nanmu_green = "#33ff3d";

        var tomorrow = moment().add(1,"days").format('YYYY-MM-DD');
        var today = moment().format('YYYY-MM-DD');
        var yestoday = moment().add(-1,"days").format('YYYY-MM-DD');
        var aweekago = moment().add(-8,"days").format('YYYY-MM-DD');


        var vu = new Vue({
            el: '.sum-info',
            data: {
                // alarmNum:'-',
                // onlineNum:"-",
                // deviceNum:"-",
                // todayFeed:'-',
                // houseNum:'-',
                // pigNum:'-'
                pig_num_total: '-',
				num_stop: '-',
				today_feed: '-',
				yestoday_feed: '-',
				today_water: '-',
				yestoday_water: '-',
				today_feed_diff: 0,
				today_water_diff: 0,
				online_num: 0,
				offline_num: 0,
				alarm_device_num: 0,
				son_total: '-',
				pig_num1: '-',
				pig_num2: '-',
				pig_num3: '-',
				pig_num4: '-',
				pig_num5: '-',
				house_num: '-',
				gw_num: '-',
				gw_alive_num: '-',
				gw_all_online: false,

				online_per: 0,
            },
            methods: {
            }
        });

        token = 'Bearer ' + token;
        layui.config({
            base: '../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'table','form','element','transfer'], function(){
            $ = layui.$;
            table = layui.table;
            form = layui.form;
            element = layui.element;
            toastr.options = {
                "closeButton": false, //是否显示关闭按钮
                "debug": false, //是否使用debug模式
                "positionClass": "toast-top-center",//弹出窗的位置
                "showDuration": "300",//显示的动画时间
                "hideDuration": "1000",//消失的动画时间
                "timeOut": "2000", //展现时间
                "extendedTimeOut": "1000",//加长展示时间
                "showEasing": "swing",//显示时的动画缓冲方式
                "hideEasing": "linear",//消失时的动画缓冲方式
                "showMethod": "fadeIn",//显示时的动画方式
                "hideMethod": "fadeOut" //消失时的动画方式
            };

            $.ajax({
                type: 'GET',
                url: '../Api/User/Actions',
                data: {func_url:func_url},
                beforeSend: function(request) {
                    request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                },
                dataType: "json",
                success: function (data) {
                    console.info(data)
                    actions=data.data;
                    for(var i=0;i<actions.length;i++){
                        $('.action-'+actions[i].action_id).removeClass("layui-hide");
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.msg('加载操作信息失败');
                }
            });

            $.ajax({
                type: 'GET',
                url: '../Api/Farm',
                data: {id:cur_farm_id},
                beforeSend: function(request) {
                    request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                },
                dataType: "json",
                success: function (res) {
                    if(res.code>=0){
                        if(res.count>0){
                            cur_farm  = res.data[0];
                            $("#farmname").html(cur_farm.farmname);
                        }

                    }else{
                        layer.alert(res.msg);
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.msg('加载信息失败');
                },
                complete: function(XMLHttpRequest, textStatus) {
                    layer.closeAll('loading');
                },

            });

            loadHouse(cur_farm_id,cur_house_id);
            setInterval(function () {
                loadHouse(cur_farm_id,cur_house_id);
            },60*1000);

            form.render('select');

            //栏舍切换
            form.on('select(house)', function(data){
                var id=data.value;
                cur_house_id = id;
                console.info("housid",cur_house_id);
                loadHouse(cur_farm_id,cur_house_id);
            });

            initCharts();
            resize();
            initCanvas();

            
        });
        function initCharts(){
            chart1 = echarts.init(document.getElementById('chart1'));
            chart2 = echarts.init(document.getElementById('chart2'));
        }

        function initCanvas(){
            var h = $(".canvas_contain").height();
            var w = $(".canvas_contain").width();
            console.info(h,w);

            document.getElementById("canvas").height = h;
            document.getElementById("canvas").width = w;
            canvas = document.getElementById('canvas');
            $("#canvas").css({"width":w+"px","height":h+"px"});

            stage = new JTopo.Stage(canvas);
            stage.eagleEye.visible = true;
            stage.mode = "select";
            stage.wheelZoom = 0.9;
            scene = new JTopo.Scene(stage);
            scene.backgroundColor = '10,20,52';
            //scene.background = '__PUBLIC__/img/feed/bg.png';
            scene.mode = "normal";
            //scene.mode = "drag";
            //scene.lastTranslatedX=0;
            //scene.lastTranslatedY=0;
            scene.click(function(event){
                //console.log("scene单击");
                $("#menu").hide();
            });
        }

        function buildBasicMap(){
            console.info("buildBasicMap")
            for(var i=0;i<all_nodes.length;i++){
                scene.remove(all_nodes[i]);
            }
            scene.clear();//删除所有节点
            all_nodes=[];
            if(max_col==0 && max_row==0 ){
                return;
            }

            var x=30;
            var y=30;
            var offsetX=120+20;
            var offsetY=100+20;
            for(var i=0;i<=max_row;i++){
                for(var j=0;j<=max_col;j++){
                    var img_offset = i*55;
                    //room
                    var node = new JTopo.Node();
                    //node.setImage(getImgPath(0,false,false,false), false);
                    node.setImage("../img/room_bg.png", false);
                    
                    node.type = "room";
                    node.room_row = i;
                    node.room_col = j;
                    //node.text = 'L:'+(i+1)+' R:'+(j+1); // 文字
                    //node.name = 'L:'+(i+1)+' R:'+(j+1); // 文字
                    node.fontColor=white_color;
                    node.textPosition = "Middle_Center";
                    node.textOffsetY = -40;
                    node.font = '12px 微软雅黑';
                    node.showSelected = true;
                    node.dragable =false;
                    node.slaveDisable=false;
                    node.setLocation(x+(offsetX*j), y+(offsetY*i)); // 位置
                    node.setSize(120, 100);  // 尺寸
                    node.alpha = 1; //透明度
                    node.fillColor = trans_bg;
                    scene.add(node);
                    all_nodes.push(node);
                    bindNodeEvent(node);



                    var matchs = $.grep(ActiveNodeParas,function (item) {
                        return  item.Row == node.room_row && item.Col == node.room_col;
                    });
                    if(matchs.length>0){
                        var match = matchs[0];
                        node.enable = true;
                        node.text = match.Hnum;
                        node.num = match.Hnum;
                        node.sn = match.Sn;
                        node.device_type = match.device_type;//拓展device_type字段

                        //猪
                        var pigNode = new JTopo.Node();
                        pigNode.setImage("../img/pig_green.png", false);
                        pigNode.sn = match.Sn;
                        pigNode.num = match.Hnum;
                        pigNode.device_type = match.device_type;
                        pigNode.type = "pig";
                        pigNode.room_row = i;
                        pigNode.room_col = j;
                        pigNode.textPosition = "Middle_Center";
                        pigNode.textOffsetY = -40;
                        pigNode.showSelected = false;
                        pigNode.dragable =false;
                        pigNode.slaveDisable=false;
                        pigNode.setLocation(x+(offsetX*j)+10, y+(offsetY*i)+28); // 位置
                        pigNode.setSize(20, 48);  // 尺寸
                        pigNode.alpha = 1; //透明度
                        pigNode.visible = false;
                        scene.add(pigNode);
                        all_nodes.push(pigNode);
                        bindNodeEvent(pigNode);

                        //水
                        var waterNode = new JTopo.Node();
                        waterNode.setImage("../img/water_green.png", false);
                        waterNode.sn = match.Sn;
                        waterNode.num = match.Hnum;
                        waterNode.device_type = match.device_type;
                        waterNode.type = "water_status";
                        waterNode.room_row = i;
                        waterNode.room_col = j;
                        waterNode.textPosition = "Middle_Center";
                        //waterNode.textOffsetY = -40;
                        waterNode.showSelected = false;
                        waterNode.dragable =false;
                        waterNode.slaveDisable=false;
                        waterNode.setLocation(x+(offsetX*j)+92, y+(offsetY*i)+8); // 位置
                        waterNode.setSize(16, 16);  // 尺寸
                        waterNode.alpha = 1; //透明度
                        waterNode.visible = false;
                        scene.add(waterNode);
                        all_nodes.push(waterNode);
                        bindNodeEvent(waterNode);

                        var textNode = new JTopo.TextNode('下料: --/-- kg');
                        textNode.sn = match.Sn;
                        textNode.num = match.Hnum;
                        textNode.device_type = match.device_type;
                        textNode.room_row = i;
                        textNode.room_col = j;
                        textNode.type="feed";
                        textNode.font = '9px 微软雅黑';
                        textNode.setLocation(x+(offsetX*j)+35, y+(offsetY*i)+20); // 位置
                        //textNode.setSize(100, 15);
                        textNode.fontColor=gray_color; //透明
                        textNode.showSelected = false;
                        textNode.dragable =false;
                        scene.add(textNode);
                        all_nodes.push(textNode);
                        bindNodeEvent(textNode);

                        textNode = new JTopo.TextNode('下水: -- L');
                        textNode.sn = match.Sn;
                        textNode.num = match.Hnum;
                        textNode.device_type = match.device_type;
                        textNode.room_row = i;
                        textNode.room_col = j;
                        textNode.type="water";
                        textNode.font = '9px 微软雅黑';
                        textNode.setLocation(x+(offsetX*j)+35, y+(offsetY*i)+20+18); // 位置
                        //textNode.setSize(100, 15);
                        textNode.fontColor=gray_color; //透明
                        textNode.showSelected = false;
                        textNode.dragable =false;
                        scene.add(textNode);
                        all_nodes.push(textNode);
                        bindNodeEvent(textNode);

                        textNode = new JTopo.TextNode('-/-天');
                        textNode.sn = match.Sn;
                        textNode.num = match.Hnum;
                        textNode.device_type = match.device_type;
                        textNode.room_row = i;
                        textNode.room_col = j;
                        textNode.type="mode_day";
                        textNode.font = '10px 微软雅黑';
                        textNode.setLocation(x+(offsetX*j)+35, y+(offsetY*i)+18+17+20); // 位置
                        //textNode.setSize(100, 15);
                        textNode.fontColor=gray_color; //透明
                        textNode.showSelected = false;
                        textNode.dragable =false;
                        scene.add(textNode);
                        all_nodes.push(textNode);
                        bindNodeEvent(textNode);

                        



                    }else{
                        node.enable = false;
                        node.alpha = 0.2; //没有绑定饲喂器的不显示
                        node.setImage("../img/room_bg_gray.png", false);
                    }



                }
            }
        }

        function displayStatus() {
            var nodes = all_nodes;
            var matchs=$.grep(nodes,function(node){
                return node.type=="room" && node.enable == true;
            });
            if(matchs.length>0){
                for(var i=0;i<matchs.length;i++){
                    var node = matchs[i];
                    var sn = matchs[i].sn;
                    //对应饲喂器在线/离线
                    var states = $.grep(ActiveNodeStates,function (item) {
                       return item.sn == sn;
                    });
                    if(states.length>0){
                        node.online = states[0].online;
                        //console.info(states[0])
                        if(states[0].online>0){
                            //在线
                            node.setImage("../img/room_bg.png", false);
                            if(states[0].AlarmState>0){
                                //有告警
                                //console.info(states[0].AlarmState)
                                node.alarm=states[0].AlarmStr;
                                //node.alarmColor = '255,0,0';
                                node.alarmColor = '255,100,0';
                            }
                            else if(states[0].alarm_ext>0){
                                node.alarm="空转告警";
                                node.alarmColor = '255,100,0';
                            }
                            else{
                                //无告警
                                node.alarm=null;
                                //node.alarmColor = '0,255,0';
                            }

                            //模式，停用时候半透明
                            if(states[0].Mode==0){
                                node.alpha = 1; //没有绑定饲喂器的不显示
                                node.setImage("../img/room_bg_gray.png", false);
                            }
                        }else{
                            //离线
                            //node.setImage("../img/room_bg_gray.png", false);
                            node.alarm="设备离线";
                            node.alarmColor = '255,100,0';
                        }
                    }else{
                        //从未在线过，不产生离线告警
                        node.alarm="未正确接入";
                        node.alarmColor = '255,100,0';
                    }
                }
            }

            matchs=$.grep(nodes,function(node){
                return node.type=="feed";
            });
            if(matchs.length>0){
                for(var i=0;i<matchs.length;i++){
                    var node = matchs[i];
                    var sn = matchs[i].sn;
                    //对应饲喂器在线/离线
                    var states = $.grep(ActiveNodeStates,function (item) {
                        return item.sn == sn;
                    });
                    if(states.length>0){
                        node.online = states[0].online;
                        if(states[0].online>0){
                            //在线
                            //console.info(states[0])
                            var val =(formatFloat(states[0].DayUseFeedAuto,2)+formatFloat(states[0].DayUseFeedMan,2)).toFixed(2)+"/"+ states[0].MaxFeed
                            node.text="下料: "+val+" kg";
                        }else{
                            //离线
                            node.text="下料: --/-- kg";
                        }
                    }
                }
            }

            matchs=$.grep(nodes,function(node){
                return node.type=="water";
            });
            if(matchs.length>0){
                for(var i=0;i<matchs.length;i++){
                    var node = matchs[i];
                    var sn = matchs[i].sn;
                    //对应饲喂器在线/离线
                    var states = $.grep(ActiveNodeStates,function (item) {
                        return item.sn == sn;
                    });
                    if(states.length>0){
                        node.online = states[0].online;
                        if(states[0].online>0){
                            //在线
                            //console.info(states[0])
                            var val =(formatFloat(states[0].DayUseWaterAuto,2)+formatFloat(states[0].DayUseWaterMan,2))
                            node.text="下水: "+val.toFixed(2)+" L";
                        }else{
                            //离线
                            node.text="下水: -- L";
                        }
                    }
                }
            }

            matchs=$.grep(nodes,function(node){
                return node.type=="mode_day";
            });
            if(matchs.length>0){
                for(var i=0;i<matchs.length;i++){
                    var node = matchs[i];
                    var sn = matchs[i].sn;
                    var device_type = matchs[i].device_type;
                    //对应饲喂器在线/离线
                    var states = $.grep(ActiveNodeStates,function (item) {
                        return item.sn == sn;
                    });
                    if(states.length>0){
                        var state = states[0];
                        node.online = state.online;

                        if(device_type=="HZFGW"){
                            var txt = decodeMode(state.Mode);
                            node.text=(txt+"/"+state.Gday+"天");            
                        }else if(device_type=="DMXFGW"){
                            if(state.Mode==EMODE_IDLE){
                                node.text=("空栏"+"/"+state.Gday+"天");   
                            }else{
                                var txt = decodeModeNew(state.Mode);
                                node.text=(txt+"/"+state.Gday+"天");   
                            }
                            
                        }
                        
                    }
                }
            }

            matchs=$.grep(nodes,function(node){
                return node.type=="pig";
            });

            if(matchs.length>0){
                for(var i=0;i<matchs.length;i++){
                    var node = matchs[i];
                    var sn = matchs[i].sn;
                    //对应饲喂器在线/离线
                    var states = $.grep(ActiveNodeStates,function (item) {
                        return item.sn == sn;
                    });
                    //console.info(states)
                    if(states.length>0){
                        var state = states[0];
                        //console.info(state);
                        node.online = state.online;
                        if(state.online>0){
                            //在线
                            //console.info(state.Mode);
                            if(state.Mode==EMODE_IDLE){
                                console.info(state);
                                node.visible=false;
                                node.setImage("../img/pig_red.png", false);
                            }else{
                                node.visible=true;
                                node.setImage("../img/pig_green.png", false);
                            }
                        }else{
                            //离线
                        }
                    }
                }
            }

            matchs=$.grep(nodes,function(node){
                return node.type=="water_status";
            });
            
            if(matchs.length>0){
                for(var i=0;i<matchs.length;i++){
                    var node = matchs[i];
                    var sn = matchs[i].sn;
                    
                    //对应饲喂器在线/离线
                    var states = $.grep(ActiveNodeStates,function (item) {
                        return item.sn == sn;
                    });
                    var paras = $.grep(ActiveNodeParas,function (item) {
                        return item.Sn == sn;
                    });
                    
                    //console.info(ActiveNodeParas);
                    if(states.length>0 && paras.length>0){
                        var state = states[0];
                        var para = paras[0];
                        console.info(state);
                        console.info(para);
                        node.online = state.online;
                        if(state.online>0){
                            //在线
                            
                            console.info("Adval:",state.Adval);
                            console.info("有余料AD值:",para.CalAD);
                            console.info("无余料AD值:",para.CalADR);
                            //console.info("余料检测:",para.YlCheck[state.Mode - 1]);
                            //if(para.YlCheck && para.YlCheck[state.Mode - 1]>0){
                            if(1>0){
                                node.visible = true;
                                if(parseInt(para.CalADR)<parseInt(state.Adval)){
                                    console.info("无水");
                                    //无水
                                    node.setImage("../img/water_empty.png", false);
                                }else if(parseInt(para.CalAD)>parseInt(state.Adval)){
                                    //有水
                                    console.info("有水");
                                    node.setImage("../img/water_blue.png", false);
                                }
                            }else{
                                //没有开启余料检测
                                node.visible = false;
                            }
                        }else{
                            //离线
                            node.visible = false;
                        }
                    }else{
                        node.visible = false;
                    }
                }
            }
        }

        function bindNodeEvent(node) {

            node.click(function(event){

                currentNode = this;
                console.info(currentNode);
                console.info("type:",currentNode.type," sn:",currentNode.sn," device_type:",currentNode.device_type);
                //onShowDetailStatus(currentNode);
                if(currentNode.device_type=="HZFGW"){
                    onShowDetailStatus(currentNode);
                }
                else if(currentNode.device_type=="DMXFGW"){
                    onShowDetailStatusNew(currentNode);
                }
            });
        }

        function onShowDetailStatus() {

            var sn = currentNode.sn;
            var num = currentNode.num;

            var states = $.grep(ActiveNodeStates,function (item) {
                return item.sn == sn;
            });
            var paras = $.grep(ActiveNodeParas,function (item) {
                return item.Sn == sn;
            });


            if(states.length>0 && paras.length>0){

                var obj = states[0];
                var para = paras[0];
                console.info(obj,para);

                var active = {
                    set: function(othis){
                        var THIS = 'layui-bg-normal'
                            ,key = othis.data('key')
                            ,options = {};

                        othis.css('background-color', '#4958b9').siblings().removeAttr('style');
                        var val = othis.data('value');
                        console.info("value",val);
                        $(".div_his").addClass("layui-hide");
                        $("."+val).removeClass("layui-hide");
                    }
                };
                var active1 = {
                    set: function(othis){
                        var THIS = 'layui-bg-normal'
                            ,key = othis.data('key')
                            ,options = {};

                        othis.css('background-color', '#4958b9').siblings().removeAttr('style');
                        var val = othis.data('value');
                        console.info("value",val);
                        $(".div_plan").addClass("layui-hide");
                        $("."+val).removeClass("layui-hide");
                    }
                };
                var active2 = {
                    set: function(othis){
                        var THIS = 'layui-bg-normal'
                            ,key = othis.data('key')
                            ,options = {};

                        othis.css('background-color', '#4958b9').siblings().removeAttr('style');
                        var val = othis.data('value');
                        console.info("value",val);
                        $(".div_alarm").addClass("layui-hide");
                        $("."+val).removeClass("layui-hide");
                    }
                };
                

                /* chrome 不加入延时会绑定事件失败*/
                setTimeout(function () {
                    $('.history_btns .layui-btn').off();
                    $('.plan_btns .layui-btn').off();
                    $('.alarm_btns .layui-btn').off();
                    $('.history_btns .layui-btn').on('click', function(){
                        //console.info("history_btns clicks")
                        var othis = $(this), type = othis.data('type');
                        //console.info(othis)
                        active[type] ? active[type].call(this, othis) : '';
                    });

                    $('.plan_btns .layui-btn').on('click', function(){
                        var othis = $(this), type = othis.data('type');
                        active1[type] ? active1[type].call(this, othis) : '';
                    });
                    $('.alarm_btns .layui-btn').on('click', function(){
                        var othis = $(this), type = othis.data('type');
                        active2[type] ? active2[type].call(this, othis) : '';
                    });
                },500);
                
                //运行时间统计
                /*if(para.first_online){
                    let dura = moment().unix() - moment(para.first_online).unix();
                    console.info("dura=",dura);
                    console.info("moment().format('x')=",moment().unix());
                    console.info("moment(para.first_online).format('x')=",moment(para.first_online).unix());
                    var dura_str = beautyTimeSpan(dura);
                    console.info("dura_str=",dura_str);
                    //obj.dura_str = dura_str;
                    $("#title_dura").html("运行:"+dura_str);
                }*/

                //耳标，猪种
                //obj.earmark = obj.earmark ||'未设置';
                //obj.pig_type = obj.pig_type ||'未设置';

                if(currentNode.online>0){
                    $("#title_online").show();
                    $("#title_offline").hide();
                    if(obj.Mode==0){
                        $("#title_disable").show();
                    }else{
                        $("#title_disable").hide();
                    }

                    $("#title_ver").show();
                    $("#title_ver").html("版本号:"+obj.Version);
                    $("#title_sn").show();
                    $("#title_sn").html("SN:"+obj.sn);
                    /*if(obj.alarm>0){
                        $("#title_alarm").show();
                        $("#title_alarm").html("告警:"+obj.AlarmStr);
                    }else{
                        $("#title_alarm").hide();
                    }*/
                }else{
                    $("#title_online").hide();
                    $("#title_offline").show();
                    $("#title_disable").hide();
                    $("#title_sn").hide();
                    $("#title_ver").hide();
                    //$("#title_alarm").hide();
                    //layer.alert("当前饲喂器离线");
                }

                

                //告警
                var alarm_arr=[];

                if(obj.AlarmState>0){
                    var bin_alarm = getBinStr(obj.AlarmState);
                    console.info("bin_alarm",bin_alarm);

                    if(getByteBit(obj.AlarmState,0)>0){
                        alarm_arr.push("电机堵塞\n");
                    }
                    if(getByteBit(obj.AlarmState,1)>0){
                        alarm_arr.push("出水堵塞\n");
                    }
                    if(getByteBit(obj.AlarmState,2)>0){
                        alarm_arr.push("探针异常\n");
                    }
                    if(getByteBit(obj.AlarmState,3)>0){
                        alarm_arr.push("触碰异常\n");
                    }
                    if(getByteBit(obj.AlarmState,4)>0){
                        alarm_arr.push("电机异常\n");
                    }
                    if(getByteBit(obj.AlarmState,5)>0){
                        alarm_arr.push("下水异常\n");
                    }
                    if(getByteBit(obj.AlarmState,6)>0){
                        alarm_arr.push("电机空转\n");
                    }
                }

                if(obj.alarm_ext){
                    alarm_arr.push("空转");
                }

                if(alarm_arr.length>0){
                    $("#title_alarm").show();
                    $("#title_alarm").html("告警:"+alarm_arr.join(","));
                }else{
                    $("#title_alarm").hide();
                }



                obj.ModeDesc = decodeMode(obj.Mode);

                if(obj.FeedWater==0){
                    obj.FeedWater="不出水";
                }else if(obj.FeedWater==1){
                    obj.FeedWater="1:1";
                }else if(obj.FeedWater==2){
                    obj.FeedWater="1:2";
                }else if(obj.FeedWater==3){
                    obj.FeedWater="1:3";
                }else if(obj.FeedWater==4){
                    obj.FeedWater="1:4";
                }else if(obj.FeedWater==4){
                    obj.FeedWater="1:5";
                }

                //$("#form_status")[0].reset();
                form.val("form_status",obj);

                layer.open({
                    //area: 'auto',
                    area:['650px','500px'],
                    offset: '10%',
                    shade: 0.5,
                    shadeClose: true,
                    type: 1,
                    title: num, //不显示标题
                    content: $('#detail'), //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
                    maxmin: false,
                    btn: ['确定'],
                    yes: function(index, layero){
                        //点击确认触发 iframe 内容中的按钮提交
                        lay_index=index;
                        layer.close(lay_index);
                    }
                });

                var val = (formatFloat(states[0].DayUseFeedAuto,2)+formatFloat(states[0].DayUseFeedMan,2)).toFixed(2)+"/"+ states[0].MaxFeed;
                var per = 0;
                if(states[0].MaxFeed>0){
                    var per = (formatFloat(states[0].DayUseFeedAuto,2)+formatFloat(states[0].DayUseFeedMan,2))/formatFloat(states[0].MaxFeed,2) * 100;
                }

                element.progress('progress1', per.toFixed(1)+"%");

                //时间表
                var para =paras[0];
                console.info(para);
                var data = [
                ];

                for(var i=0;i<6;i++){
                    data.push({
                        Idx:(i+1),
                        StartT: para.StartT[i],
                        EndT: para.EndT[i],
                        OutT: para.OutT[i],
                    });
                }

                table.render({
                    elem: '#table_time1'
                    ,data:data
                    ,height: '250'
                    //,url: "{:u('Admin/getAlarmMsgPageList')}"
                    //,height: '300'
                    //,method:'post'
                    //,headers : {'Authorization': 'Bearer '+window.localStorage.getItem("token")}
                    ,where: {}
                    ,page: false
                    ,limit:20
                    ,title: ''
                    ,even:false
                    ,size: 'sm' //小尺寸的表格
                    ,skin: 'nob' //无框风格
                    ,cols: [[
                        //{type: 'checkbox', fixed: 'left'}
                        {field:'Idx', title:'序号', sort: false,width:70}
                        ,{field:'StartT', title:'开始时间', sort: false}
                        ,{field:'EndT', title:'结束时间', sort: false}
                        ,{field:'OutT', title:'出料量(%)', sort: false}

                    ]]
                });

                //饲喂曲线
                var data=[];
                if(para.Mode == EMODE_IDLE){
                    //停用
                }
                else if(para.Mode == EMODE_PG){
                    //妊娠
                    for(var i=0;i<15;i++)
                    {
                        data.push({No:(i+1),id:i,OutDay:para.OutDay[i],OutDayType:para.OutDayType[i],OutMax:para.OutMax[i]});
                    }
                }
                else if(para.Mode == EMODE_NP){
                    //空怀
                    data.push({No:1,id:15,OutDay:para.OutDay[15],OutDayType:para.OutDayType[15],OutMax:para.OutMax[15]});
                }
                else if(para.Mode == EMODE_CC){
                    //保育
                    for(var i=0;i<10;i++)
                    {
                        data.push({No:(i+1),id:i+16,OutDay:para.OutDay[i+16],OutDayType:para.OutDayType[i+16],OutMax:para.OutMax[i+16]});
                    }
                }
                else if(para.Mode == EMODE_FAT){
                    //育肥
                    for(var i=0;i<18;i++)
                    {
                        data.push({No:(i+1),id:i+26,OutDay:para.OutDay[i+26],OutDayType:para.OutDayType[i+26],OutMax:para.OutMax[i+26]});
                    }
                }
                else if(para.Mode == EMODE_NURSE){
                    //哺乳
                    for(var i=0;i<10;i++)
                    {
                        data.push({No:(i+1),id:i+44,OutDay:para.OutDay[i+44],OutDayType:para.OutDayType[i+44],OutMax:para.OutMax[i+44]});
                    }
                }
                else if(para.Mode == EMODE_BOAR){
                    //公猪
                    data.push({No:1,id:54,OutDay:para.OutDay[54],OutDayType:para.OutDayType[54],OutMax:para.OutMax[54]});
                }
                console.info(data);
                table.render({
                    elem: '#table_curve1'
                    ,data:data
                    ,height: '250'
                    //,url: "{:u('Admin/getAlarmMsgPageList')}"
                    //,height: '300'
                    //,method:'post'
                    //,headers : {'Authorization': 'Bearer '+window.localStorage.getItem("token")}
                    ,where: {}
                    ,page: false
                    ,limit:20
                    ,title: ''
                    ,even:false
                    ,size: 'sm' //小尺寸的表格
                    ,skin: 'nob' //无框风格
                    ,cols: [[
                        //{type: 'checkbox', fixed: 'left'}
                        {field:'No', title:'序号', sort: false,width:70}
                        ,{field:'OutDay', title:'日龄', sort: false}
                        ,{field:'OutDayType', title:'模式', sort: false,templet: function(d){
                                var html='';
                                if(d.OutDayType>0){
                                    html="线性";
                                }else{
                                    html="阶梯";
                                }
                                return html;
                            }}
                        ,{field:'OutMax', title:'当天最大出料量(kg)', sort: false}

                    ]]
                });

                //饲喂记录
                var obj={sn:para.Sn,begin:yestoday,end:tomorrow,begin_end:0,feed_type:1,tb_record:'0'};
                table.render({
                    elem: '#table_feed_his'
                    ,url: "../Api/History/FeedRecord"
                    ,height: '250'
                    ,method:'GET'
                    ,headers : {'Authorization': 'Bearer '+window.localStorage.getItem("token")}
                    ,where: obj
                    ,page: false
                    /*,initSort: {
                        field: 'hnum' //排序字段，对应 cols 设定的各字段名
                        ,type: 'asc' //排序方式  asc: 升序、desc: 降序、null: 默认排序
                    }*/
                    ,limit:100000
                    //,toolbar: '#table_toolbar' //开启头部工具栏，并为其绑定左侧模板
                    ,defaultToolbar: ['']
                    ,title: ''
                    ,even:false
                    ,size: 'sm' //小尺寸的表格
                    ,skin: 'nob' //无框风格
                    ,cols: [[
                        //{type: 'checkbox', fixed: 'left'}
                        //,fixed: 'left'
                        //{field:'addr', title:'网关SN',width:100, sort: true}
                        //,{field:'sn', title:'饲喂器SN',width:110, sort: true}
                        //,{field:'hnum', title:'栏位号',width:90, sort: true}
                        
                        {field:'rectime', title:'记录时间',width:150, sort: true,templet: function(d){
                            var html = "";
                            html = moment(d.rectime).format("YYYY-MM-DD HH:mm:ss");
                            return html;
                        }}

                        ,{field:'auto', title:'方式', sort: false,align:'center',templet: function(d){
                            var html="";
                            if(d.auto){
                                html="<span class=\"layui-text-green \" >自动</span>";
                            }else{
                                if(d.remote){
                                    html="<span class=\"layui-text-orange\">远程手动</span>";
                                }else if(d.emergency){
                                    html="<span class=\"layui-text-orange\">紧急手动</span>";
                                }
                                else{
                                    html="<span class=\"layui-text-orange\">手动</span>";
                                }
                            }
                            return html;
                        }}


                        //,{field:'event', title:'描述',width:110, sort: false,align:'left'}

                        //,{field:'max_feed', title:'当天最大出料',width:110, sort: false,align:'right'}
                        ,{field:'amount', title:'出料(kg)', sort: false,align:'right'}
                        ,{field:'day_use_feed', title:'当日累计(kg)', sort: false,align:'right'}
                        //,{field:'day_use_water', title:'累计出水(L)',width:100, sort: false,align:'right'}
                        //,{field:'vin_calc', title:'输入电压',width:90, sort: false,align:'right'}
                        //,{field:'motor_vol', title:'电机电压',width:90, sort: false,align:'right'}
                        ,{field:'motor_cur', title:'电机电流', sort: false,align:'right'}

                    ]]
                });

                var obj={sn:para.Sn,begin:yestoday,end:tomorrow,begin_end:0,feed_type:0,tb_record:'0'};
                table.render({
                    elem: '#table_water_his'
                    ,url: "../Api/History/FeedRecord"
                    ,height: '250'
                    ,method:'GET'
                    ,headers : {'Authorization': 'Bearer '+window.localStorage.getItem("token")}
                    ,where: obj
                    ,page: false
                    /*,initSort: {
                        field: 'hnum' //排序字段，对应 cols 设定的各字段名
                        ,type: 'asc' //排序方式  asc: 升序、desc: 降序、null: 默认排序
                    }*/
                    ,limit:100000
                    //,toolbar: '#table_toolbar' //开启头部工具栏，并为其绑定左侧模板
                    ,defaultToolbar: ['']
                    ,title: ''
                    ,even:false
                    ,size: 'sm' //小尺寸的表格
                    ,skin: 'nob' //无框风格
                    ,cols: [[
                        //{type: 'checkbox', fixed: 'left'}
                        //,fixed: 'left'
                        //{field:'addr', title:'网关SN',width:100, sort: true}
                        //,{field:'sn', title:'饲喂器SN',width:110, sort: true}
                        //,{field:'hnum', title:'栏位号',width:90, sort: true}
                        {field:'rectime', title:'记录时间',width:150, sort: true,templet: function(d){
                            var html = "";
                            html = moment(d.rectime).format("YYYY-MM-DD HH:mm:ss");
                            return html;
                        }}


                        ,{field:'auto', title:'方式', sort: false,align:'center',templet: function(d){
                                return d.auto?"<span class=\"layui-text-green \" >自动</span>":"<span class=\"layui-text-orange\">手动</span>";
                            }}


                        //,{field:'event', title:'描述',width:110, sort: false,align:'left'}

                        //,{field:'max_feed', title:'当天最大出料',width:110, sort: false,align:'right'}
                        ,{field:'amount', title:'出水(L)', sort: false,align:'right'}
                        //,{field:'day_use_feed', title:'当日累计(kg)', sort: false,align:'right'}
                        ,{field:'day_use_water', title:'当日累计(L)', sort: false,align:'right'}
                        //,{field:'vin_calc', title:'输入电压',width:90, sort: false,align:'right'}
                        //,{field:'motor_vol', title:'电机电压',width:90, sort: false,align:'right'}
                        //,{field:'motor_cur', title:'电机电流', sort: false,align:'right'}

                    ]]
                });

                var obj={sn:para.Sn,begin:yestoday,end:tomorrow,tb_record:1};
                table.render({
                    elem: '#table_tb_his'
                    ,url: "../Api/History/FeedRecord"
                    ,height: '250'
                    ,method:'GET'
                    ,headers : {'Authorization': 'Bearer '+window.localStorage.getItem("token")}
                    ,where: obj
                    ,page: false
                    /*,initSort: {
                        field: 'hnum' //排序字段，对应 cols 设定的各字段名
                        ,type: 'asc' //排序方式  asc: 升序、desc: 降序、null: 默认排序
                    }*/
                    ,limit:100000
                    //,toolbar: '#table_toolbar' //开启头部工具栏，并为其绑定左侧模板
                    ,defaultToolbar: ['']
                    ,title: ''
                    ,even:false
                    ,size: 'sm' //小尺寸的表格
                    ,skin: 'nob' //无框风格
                    ,cols: [[
                        //{type: 'checkbox', fixed: 'left'}
                        //,fixed: 'left'
                        //{field:'addr', title:'网关SN',width:100, sort: true}
                        //,{field:'sn', title:'饲喂器SN',width:110, sort: true}
                        //,{field:'hnum', title:'栏位号',width:90, sort: true}
                        {field:'rectime', title:'记录时间',width:150, sort: true,templet: function(d){
                            var html = "";
                            html = moment(d.rectime).format("YYYY-MM-DD HH:mm:ss");
                            return html;
                        }}


                        ,{field:'auto', title:'方式',width:70, sort: false,align:'center',templet: function(d){
                                return d.auto?"<span class=\"layui-text-green \" >自动</span>":"<span class=\"layui-text-orange\">手动</span>";
                            }}

                        ,{field:'feed_type', title:'类型',width:70, sort: false,align:'center',templet: function(d){
                                return d.feed_type?"<span class=\"layui-text-orange-light \" >出料</span>":"<span class=\"layui-text-blue-light\">出水</span>";
                            }}
                        ,{field:'event', title:'描述', sort: false,align:'left'}

                        //,{field:'max_feed', title:'当天最大出料',width:110, sort: false,align:'right'}
                        ,{field:'amount', title:'出料水(kg/L)', sort: false,align:'right'}
                        //,{field:'day_use_feed', title:'当日累计(kg)', sort: false,align:'right'}
                        //,{field:'day_use_water', title:'当日累计(L)', sort: false,align:'right'}
                        //,{field:'vin_calc', title:'输入电压',width:90, sort: false,align:'right'}
                        //,{field:'motor_vol', title:'电机电压',width:90, sort: false,align:'right'}
                        //,{field:'motor_cur', title:'电机电流', sort: false,align:'right'}

                    ]]
                });

                //当前告警
                var obj={sn:para.Sn,status:"1"};
                table.render({
                    elem: '#table_alarm_now'
                    //,data:data
                    ,url:'../Api/Alarm'
                    ,height: '250'
                    ,method:'GET'
                    ,headers : {'Authorization': 'Bearer '+window.localStorage.getItem("token")}
                    ,where: obj
                    ,page: false
                    ,limit:100000
                    //,toolbar: '#table_toolbar' //开启头部工具栏，并为其绑定左侧模板
                    ,defaultToolbar: ['']
                    ,title: ''
                    ,even:true
                    ,size: 'sm' //小尺寸的表格
                    ,skin: 'nob' //无框风格
                    ,cols: [[
                        //{field:'sn', title:'SN', width:100,  sort: true},
                        {field:'alarm_content', title:'告警内容',  sort: true,templet: function(d){
                                var html = "";
                                if(d.status==0){
                                    html+="<span class=\"layui-text-green\">"+d.alarm_content+"</span> "
                                }else{
                                    html+="<span class=\"layui-text-red\">"+d.alarm_content+"</span>"
                                }
                                return html;
                            }}
                        ,{field:'add_time', title:'发生时间', width:200, sort: true}
                    ]]
                    ,done: function(res, curr, count){
                        for(var i=0;i<actions.length;i++){
                            $('.action-'+actions[i].action_id).removeClass("layui-hide");
                        }
                        var that = this.elem.next();

                    }
                });

                var obj={sn:para.Sn,begin:aweekago,end:tomorrow};
                table.render({
                    elem: '#table_alarm_his'
                    //,data:data
                    ,url:'../Api/Alarm'
                    ,height: '250'
                    ,method:'GET'
                    ,headers : {'Authorization': 'Bearer '+window.localStorage.getItem("token")}
                    ,where: obj
                    ,page: false
                    ,limit:100000
                    //,toolbar: '#table_toolbar' //开启头部工具栏，并为其绑定左侧模板
                    ,defaultToolbar: ['']
                    ,title: ''
                    ,even:true
                    ,size: 'sm' //小尺寸的表格
                    ,skin: 'nob' //无框风格
                    ,cols: [[
                        //{field:'sn', title:'SN', width:100,  sort: true},
                        {field:'status', title:'状态',width:80, sort: false,align:'center',templet: function(d){
                                var html = "";
                                if(d.status==0){
                                    html+="<span class=\"layui-badge-dot layui-bg-blue\"></span> 已取消"
                                }else{
                                    html+="<span class=\"layui-badge-dot layui-bg-red\"></span> 告警中"
                                }
                                return html;
                            }},
                        {field:'alarm_content', title:'告警内容',  sort: true,templet: function(d){
                                var html = "";
                                if(d.status==0){
                                    html+="<span class=\"layui-text-green\">"+d.alarm_content+"</span> "
                                }else{
                                    html+="<span class=\"layui-text-red\">"+d.alarm_content+"</span>"
                                }
                                return html;
                            }}
                        ,{field:'add_time', title:'发生时间', width:200, sort: true}
                        ,{field:'cancel_time', title:'取消时间', width:200, sort: true}
                    ]]
                    ,done: function(res, curr, count){
                        for(var i=0;i<actions.length;i++){
                            $('.action-'+actions[i].action_id).removeClass("layui-hide");
                        }
                        var that = this.elem.next();

                    }
                });

            }else{
                layer.alert("无相关数据");
            }


        }
        

        function onShowDetailStatusNew(){
            var sn = currentNode.sn;
            var num = currentNode.num;

            var states = $.grep(ActiveNodeStates,function (item) {
                return item.sn == sn;
            });
            var paras = $.grep(ActiveNodeParas,function (item) {
                return item.Sn == sn;
            });

            

            if(states.length>0 && paras.length>0){
                var obj = states[0];
                var status = states[0];
                var para = paras[0];
                console.info(status,para);

                console.info("Adval:",status.Adval);
                console.info("有余料AD值:",para.CalAD);
                console.info("无余料AD值:",para.CalADR);
                //console.info("余料检测:",para.YlCheck[obj.mode - 1]);
                if(para.YlCheck && para.YlCheck[obj.mode - 1]>0){
                    if(parseInt(para.CalADR)<parseInt(status.Adval)){
                        obj.other="无水";
                    }else if(parseInt(para.CalAD)>parseInt(status.Adval)){
                        obj.other="有水";
                    }else{
                        obj.other="";
                    }
                }else{
                    obj.other="";
                }

                var active = {
                    set: function(othis){
                        var THIS = 'layui-bg-normal'
                            ,key = othis.data('key')
                            ,options = {};

                        othis.css('background-color', '#4958b9').siblings().removeAttr('style');
                        var val = othis.data('value');
                        console.info("value",val);
                        $(".div_his").addClass("layui-hide");
                        $("."+val).removeClass("layui-hide");
                    }
                };
                
                var active2 = {
                    set: function(othis){
                        var THIS = 'layui-bg-normal'
                            ,key = othis.data('key')
                            ,options = {};

                        othis.css('background-color', '#4958b9').siblings().removeAttr('style');
                        var val = othis.data('value');
                        console.info("value",val);
                        $(".div_alarm").addClass("layui-hide");
                        $("."+val).removeClass("layui-hide");
                    }
                };

                /* chrome 不加入延时会绑定事件失败*/
                setTimeout(function () {
                    $('.history_btns .layui-btn').off();
                    $('.plan_btns .layui-btn').off();
                    $('.alarm_btns .layui-btn').off();
                    $('.history_btns .layui-btn').on('click', function(){
                        //console.info("history_btns clicks")
                        var othis = $(this), type = othis.data('type');
                        //console.info(othis)
                        active[type] ? active[type].call(this, othis) : '';
                    });

                    $('.plan_btns .layui-btn').on('click', function(){
                        var othis = $(this), type = othis.data('type');
                        active1[type] ? active1[type].call(this, othis) : '';
                    });
                    $('.alarm_btns .layui-btn').on('click', function(){
                        var othis = $(this), type = othis.data('type');
                        active2[type] ? active2[type].call(this, othis) : '';
                    });
                },500);

                //运行时间统计
                if(obj.first_online){
                    let dura = moment().unix() - moment(obj.first_online).unix();
                    console.info("dura=",dura);
                    console.info("moment().format('x')=",moment().unix());
                    console.info("moment(obj.first_online).format('x')=",moment(obj.first_online).unix());
                    var dura_str = beautyTimeSpan(dura);
                    console.info("dura_str=",dura_str);
                    //obj.dura_str = dura_str;
                    $("#title_dura_new").html("运行:"+dura_str);
                }


                //耳标，猪种
                obj.earmark = obj.earmark ||'未设置';
                obj.pig_type = obj.pig_type ||'未设置';

                if(obj.online>0){
                    $("#title_online_new").show();
                    $("#title_offline_new").hide();
                    if(obj.mode==0){
                        $("#title_disable_new").show();
                    }else{
                        $("#title_disable_new").hide();
                    }

                    $("#title_ver_new").show();
                    $("#title_ver_new").html("版本号:"+obj.version);
                    $("#title_sn_new").show();
                    $("#title_sn_new").html("SN:"+obj.sn);
                    /*if(obj.alarm>0){
                        $("#title_alarm").show();
                        $("#title_alarm").html("告警:"+obj.AlarmStr);
                    }else{
                        $("#title_alarm").hide();
                    }*/
                }else{
                    $("#title_online_new").hide();
                    $("#title_offline_new").show();
                    $("#title_disable_new").hide();
                    $("#title_sn_new").hide();
                    $("#title_ver_new").hide();
                    //$("#title_alarm").hide();
                    //layer.alert("当前饲喂器离线");
                }

                //告警
                var alarm_arr=[];
                if(obj.alarm>0){
                    var bin_alarm = getBinStr(obj.alarm);
                    console.info("bin_alarm",bin_alarm);

                    if(getByteBit(obj.alarm,0)>0){
                        alarm_arr.push("电机堵塞\n");
                    }
                    if(getByteBit(obj.alarm,1)>0){
                        alarm_arr.push("出水堵塞\n");
                    }
                    if(getByteBit(obj.alarm,2)>0){
                        alarm_arr.push("探针异常\n");
                    }
                    if(getByteBit(obj.alarm,3)>0){
                        alarm_arr.push("触碰异常\n");
                    }
                    if(getByteBit(obj.alarm,4)>0){
                        alarm_arr.push("电机异常\n");
                    }
                    if(getByteBit(obj.alarm,5)>0){
                        alarm_arr.push("下水异常\n");
                    }
                }else{
                    
                }

                if(obj.alarm_ext){
                    alarm_arr.push("空转");
                }

                if(alarm_arr.length>0){
                    $("#title_alarm_new").show();
                    $("#title_alarm_new").html("告警:"+alarm_arr.join(","));
                }else{
                    $("#title_alarm_new").hide();
                }

                //obj.mode = decodeMode(obj.mode);
                if(obj.device_type){
                    if(obj.device_type=="HZFGW"){
                        obj.mode = decodeMode(obj.mode);
                    }else if(obj.device_type=="DMXFGW"){
                        obj.mode = decodeModeNew(obj.mode);
                    }
                }
                $("#form_status_new")[0].reset();
                form.val("form_status_new",obj);

                layer.open({
                    //area: 'auto',
                    area:['650px','500px'],
                    //area:['70%','80%'],
                    offset: '10%',
                    shade: 0.5,
                    shadeClose: true,
                    type: 1,
                    title: obj.Hnum, //不显示标题
                    content: $('#detail_new'), //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
                    maxmin: false,
                    btn: ['确定'],
                    yes: function(index, layero){
                        //点击确认触发 iframe 内容中的按钮提交
                        lay_index=index;
                        layer.close(lay_index);
                    }
                });

                var val = (formatFloat(obj.day_use_feed_auto,2)+formatFloat(obj.day_use_feed_man,2)).toFixed(2)+"/"+ obj.max_feed;
                var per = 0;
                if(obj.max_feed>0){
                    var per = (formatFloat(obj.day_use_feed_auto,2)+formatFloat(obj.day_use_feed_man,2))/formatFloat(obj.max_feed,2) * 100;
                }

                element.progress('progress1', per.toFixed(1)+"%");


                
                
                

                //饲喂记录
                var obj={sn:para.Sn,begin:yestoday,end:tomorrow,begin_end:0,feed_type:1,tb_record:'0'};
                table.render({
                    elem: '#table_feed_his_new'
                    ,url: "../Api/History/FeedRecord"
                    ,height: '250'
                    ,method:'GET'
                    ,headers : {'Authorization': 'Bearer '+window.localStorage.getItem("token")}
                    ,where: obj
                    ,page: false
                    /*,initSort: {
                        field: 'hnum' //排序字段，对应 cols 设定的各字段名
                        ,type: 'asc' //排序方式  asc: 升序、desc: 降序、null: 默认排序
                    }*/
                    ,limit:100000
                    //,toolbar: '#table_toolbar' //开启头部工具栏，并为其绑定左侧模板
                    ,defaultToolbar: ['']
                    ,title: ''
                    ,even:false
                    ,size: 'sm' //小尺寸的表格
                    ,skin: 'nob' //无框风格
                    ,cols: [[
                        //{type: 'checkbox', fixed: 'left'}
                        //,fixed: 'left'
                        //{field:'addr', title:'网关SN',width:100, sort: true}
                        //,{field:'sn', title:'饲喂器SN',width:110, sort: true}
                        //,{field:'hnum', title:'栏位号',width:90, sort: true}
                        {field:'rectime', title:'记录时间',width:150, sort: true,templet: function(d){
                            var html = "";
                            html = moment(d.rectime).format("YYYY-MM-DD HH:mm:ss");
                            return html;
                        }}


                        ,{field:'auto', title:'方式', sort: false,align:'center',templet: function(d){
                            var html="";
                            if(d.auto){
                                html="<span class=\"layui-text-green \" >自动</span>";
                            }else{
                                if(d.remote){
                                    html="<span class=\"layui-text-orange\">远程手动</span>";
                                }else if(d.emergency){
                                    html="<span class=\"layui-text-orange\">紧急手动</span>";
                                }
                                else{
                                    html="<span class=\"layui-text-orange\">手动</span>";
                                }
                            }
                            return html;
                        }}


                        //,{field:'event', title:'描述',width:110, sort: false,align:'left'}

                        //,{field:'max_feed', title:'当天最大出料',width:110, sort: false,align:'right'}
                        ,{field:'amount', title:'出料(kg)', sort: false,align:'right'}
                        ,{field:'day_use_feed', title:'当日累计(kg)', sort: false,align:'right'}
                        //,{field:'day_use_water', title:'累计出水(L)',width:100, sort: false,align:'right'}
                        //,{field:'vin_calc', title:'输入电压',width:90, sort: false,align:'right'}
                        //,{field:'motor_vol', title:'电机电压',width:90, sort: false,align:'right'}
                        ,{field:'motor_cur', title:'电机电流', sort: false,align:'right'}

                    ]]
                });

                //下水记录
                var obj={sn:para.Sn,begin:yestoday,end:tomorrow,begin_end:0,feed_type:0,tb_record:'0'};
                table.render({
                    elem: '#table_water_his_new'
                    ,url: "../Api/History/FeedRecord"
                    ,height: '250'
                    ,method:'GET'
                    ,headers : {'Authorization': 'Bearer '+window.localStorage.getItem("token")}
                    ,where: obj
                    ,page: false
                    /*,initSort: {
                        field: 'hnum' //排序字段，对应 cols 设定的各字段名
                        ,type: 'asc' //排序方式  asc: 升序、desc: 降序、null: 默认排序
                    }*/
                    ,limit:100000
                    //,toolbar: '#table_toolbar' //开启头部工具栏，并为其绑定左侧模板
                    ,defaultToolbar: ['']
                    ,title: ''
                    ,even:false
                    ,size: 'sm' //小尺寸的表格
                    ,skin: 'nob' //无框风格
                    ,cols: [[
                        //{type: 'checkbox', fixed: 'left'}
                        //,fixed: 'left'
                        //{field:'addr', title:'网关SN',width:100, sort: true}
                        //,{field:'sn', title:'饲喂器SN',width:110, sort: true}
                        //,{field:'hnum', title:'栏位号',width:90, sort: true}
                        {field:'rectime', title:'记录时间',width:150, sort: true,templet: function(d){
                            var html = "";
                            html = moment(d.rectime).format("YYYY-MM-DD HH:mm:ss");
                            return html;
                        }}


                        ,{field:'auto', title:'方式', sort: false,align:'center',templet: function(d){
                                var html="";
                                if(d.auto){
                                    html="<span class=\"layui-text-green \" >自动</span>";
                                }else{
                                    if(d.remote){
                                        html="<span class=\"layui-text-orange\">远程手动</span>";
                                    }else{
                                        html="<span class=\"layui-text-orange\">手动</span>";
                                    }
                                }
                                return html;
                            }}


                        //,{field:'event', title:'描述',width:110, sort: false,align:'left'}

                        //,{field:'max_feed', title:'当天最大出料',width:110, sort: false,align:'right'}
                        ,{field:'amount', title:'出水(L)', sort: false,align:'right'}
                        //,{field:'day_use_feed', title:'当日累计(kg)', sort: false,align:'right'}
                        ,{field:'day_use_water', title:'当日累计(L)', sort: false,align:'right'}
                        //,{field:'vin_calc', title:'输入电压',width:90, sort: false,align:'right'}
                        //,{field:'motor_vol', title:'电机电压',width:90, sort: false,align:'right'}
                        //,{field:'motor_cur', title:'电机电流', sort: false,align:'right'}

                    ]]
                });

                //触碰记录
                var obj={sn:para.Sn,begin:yestoday,end:tomorrow,tb_record:1};
                table.render({
                    elem: '#table_tb_his_new'
                    ,url: "../Api/History/FeedRecord"
                    ,height: '250'
                    ,method:'GET'
                    ,headers : {'Authorization': 'Bearer '+window.localStorage.getItem("token")}
                    ,where: obj
                    ,page: false
                    /*,initSort: {
                        field: 'hnum' //排序字段，对应 cols 设定的各字段名
                        ,type: 'asc' //排序方式  asc: 升序、desc: 降序、null: 默认排序
                    }*/
                    ,limit:100000
                    //,toolbar: '#table_toolbar' //开启头部工具栏，并为其绑定左侧模板
                    ,defaultToolbar: ['']
                    ,title: ''
                    ,even:false
                    ,size: 'sm' //小尺寸的表格
                    ,skin: 'nob' //无框风格
                    ,cols: [[
                        //{type: 'checkbox', fixed: 'left'}
                        //,fixed: 'left'
                        //{field:'addr', title:'网关SN',width:100, sort: true}
                        //,{field:'sn', title:'饲喂器SN',width:110, sort: true}
                        //,{field:'hnum', title:'栏位号',width:90, sort: true}
                        {field:'rectime', title:'记录时间',width:150, sort: true,templet: function(d){
                            var html = "";
                            html = moment(d.rectime).format("YYYY-MM-DD HH:mm:ss");
                            return html;
                        }}


                        // ,{field:'auto', title:'方式',width:70, sort: false,align:'center',templet: function(d){
                        //         return d.auto?"<span class=\"layui-text-green \" >自动</span>":"<span class=\"layui-text-orange\">手动</span>";
                        //     }}

                        // ,{field:'feed_type', title:'类型',width:70, sort: false,align:'center',templet: function(d){
                        //         return d.feed_type?"<span class=\"layui-text-orange-light \" >出料</span>":"<span class=\"layui-text-blue-light\">出水</span>";
                        //     }}
                        ,{field:'', title:'', sort: false,align:'left',templet: function(d){
                                return "<span class=\"layui-text-orange-light \" >触碰</span>";
                            }}

                        //,{field:'max_feed', title:'当天最大出料',width:110, sort: false,align:'right'}
                        //,{field:'amount', title:'出料水(kg/L)', sort: false,align:'right'}
                        //,{field:'day_use_feed', title:'当日累计(kg)', sort: false,align:'right'}
                        //,{field:'day_use_water', title:'当日累计(L)', sort: false,align:'right'}
                        //,{field:'vin_calc', title:'输入电压',width:90, sort: false,align:'right'}
                        //,{field:'motor_vol', title:'电机电压',width:90, sort: false,align:'right'}
                        //,{field:'motor_cur', title:'电机电流', sort: false,align:'right'}

                    ]]
                });

                //当前告警
                var obj={sn:para.Sn,status:"1"};
                table.render({
                    elem: '#table_alarm_now_new'
                    //,data:data
                    ,url:'../Api/Alarm'
                    ,height: '250'
                    ,method:'GET'
                    ,headers : {'Authorization': 'Bearer '+window.localStorage.getItem("token")}
                    ,where: obj
                    ,page: false
                    ,limit:100000
                    //,toolbar: '#table_toolbar' //开启头部工具栏，并为其绑定左侧模板
                    ,defaultToolbar: ['']
                    ,title: ''
                    ,even:true
                    ,size: 'sm' //小尺寸的表格
                    ,skin: 'nob' //无框风格
                    ,cols: [[
                        //{field:'sn', title:'SN', width:100,  sort: true},
                        {field:'alarm_content', title:'告警内容',  sort: true,templet: function(d){
                                var html = "";
                                if(d.status==0){
                                    html+="<span class=\"layui-text-green\">"+d.alarm_content+"</span> "
                                }else{
                                    html+="<span class=\"layui-text-red\">"+d.alarm_content+"</span>"
                                }
                                return html;
                            }}
                        ,{field:'add_time', title:'发生时间', width:200, sort: true}
                    ]]
                    ,done: function(res, curr, count){
                        for(var i=0;i<actions.length;i++){
                            $('.action-'+actions[i].action_id).removeClass("layui-hide");
                        }
                        var that = this.elem.next();

                    }
                });

                var obj={sn:para.Sn,begin:aweekago,end:tomorrow};
                table.render({
                    elem: '#table_alarm_his_new'
                    //,data:data
                    ,url:'../Api/Alarm'
                    ,height: '250'
                    ,method:'GET'
                    ,headers : {'Authorization': 'Bearer '+window.localStorage.getItem("token")}
                    ,where: obj
                    ,page: false
                    ,limit:100000
                    //,toolbar: '#table_toolbar' //开启头部工具栏，并为其绑定左侧模板
                    ,defaultToolbar: ['']
                    ,title: ''
                    ,even:true
                    ,size: 'sm' //小尺寸的表格
                    ,skin: 'nob' //无框风格
                    ,cols: [[
                        //{field:'sn', title:'SN', width:100,  sort: true},
                        {field:'status', title:'状态',width:80, sort: false,align:'center',templet: function(d){
                                var html = "";
                                if(d.status==0){
                                    html+="<span class=\"layui-badge-dot layui-bg-blue\"></span> 已取消"
                                }else{
                                    html+="<span class=\"layui-badge-dot layui-bg-red\"></span> 告警中"
                                }
                                return html;
                            }},
                        {field:'alarm_content', title:'告警内容',  sort: true,templet: function(d){
                                var html = "";
                                if(d.status==0){
                                    html+="<span class=\"layui-text-green\">"+d.alarm_content+"</span> "
                                }else{
                                    html+="<span class=\"layui-text-red\">"+d.alarm_content+"</span>"
                                }
                                return html;
                            }}
                        ,{field:'add_time', title:'发生时间', width:200, sort: true}
                        ,{field:'cancel_time', title:'取消时间', width:200, sort: true}
                    ]]
                    ,done: function(res, curr, count){
                        for(var i=0;i<actions.length;i++){
                            $('.action-'+actions[i].action_id).removeClass("layui-hide");
                        }
                        var that = this.elem.next();

                    }
                });
    

            }

            
        }

        function loadHouse(farmid,houseid) {
            //layer.load(1);
            $.ajax({
                type: 'GET',
                url: '../Api/House',
                data: {farmid:farmid},
                beforeSend: function(request) {
                    request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                },
                dataType: "json",
                success: function (res) {
                    if(res.code>=0){
                        houses = res.data;
                        if(res.count>0){
                            if(houseid){
                                var matchs= $.grep(res.data,function (item) {
                                    return item.id ==houseid;
                                })
                                if(matchs.length>0){
                                    cur_house = matchs[0];
                                }else{
                                    cur_house  = res.data[0];
                                }
                            }else{
                                cur_house  = res.data[0];
                            }

                            loadAll(cur_house.id);

                            get_device(cur_house.id).then(function(res) {
                                console.info(res);
                                if(res && res.code>=0){
                                    //设备加载成功
                                    if(res.count>0){
                                        var devices= res.data;
                                        var addrs=[];
                                        for(var i=0;i<devices.length;i++){
                                            //if(devices[i].device_type=='HZFGW'){
                                                addrs.push(devices[i].device_addr);
                                            //}
                                        }
                                        if(addrs.length>0){
                                            //读取参数，读取状态，渲染
                                            /*get_all_device_param(addrs).then(function(res) {
                                                console.info(res);
                                                if(res.code>=0){
                                                    //渲染基本
                                                    buildBasicMap();

                                                    get_all_device_status(addrs).then(function(res) {

                                                        console.info(res);
                                                        if(res.code>=0){
                                                            //渲染状态
                                                            displayStatus();
                                                        }else{
                                                            layer.alert(res.msg);
                                                        }
                                                    });
                                                }else{
                                                    layer.alert(res.msg);
                                                }
                                            });*/

                                            get_all_device_node(addrs).then(function(res) {

                                                if(res.code>=0){
                                                    console.info(ActiveNodeParas);
                                                    if(ActiveNodeParas.length>0){
                                                        //渲染基本
                                                        buildBasicMap();
                                                    }else{
                                                        //状态数据为空，可能已经离线
                                                        toastr.warning("终端设备暂时离线，请稍后再试", "提示");
                                                    }
                                                    if(ActiveNodeStates.length>0){
                                                        //渲染状态
                                                        displayStatus();
                                                    }else{
                                                        //状态数据为空，可能已经离线
                                                        toastr.warning("终端设备暂时离线，请稍后再试", "提示");
                                                    }



                                                }
                                            });
                                        }
                                    }else{
                                        layer.alert("栏舍尚未绑定任何设备");
                                    }
                                }else{
                                    layer.alert(res.msg);
                                }
                            });
                        }
                        renderSelect();
                    }else{
                        layer.alert(res.msg);
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.msg('加载信息失败');
                },
                complete: function(XMLHttpRequest, textStatus) {
                    layer.closeAll('loading');
                },

            });
        }

        function loadSummary(houseid){
            $.ajax({
                type: 'GET',
                url: '../Api/House/SummaryInfo',
                data: {id:houseid},
                beforeSend: function(request) {
                    request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                },
                dataType: "json",
                success: function (res) {
                    if(res.code>=0){
                        var list = res.data;
						if (list.length > 0) {
                            var item = list[0];
							if (item.today_feed) {
								vu.today_feed = parseFloat(item.today_feed.toFixed(1))
							} else {
								vu.today_feed = 0
							}

                            if (item.today_water) {
								vu.today_water = parseFloat(item.today_water.toFixed(1))
							} else {
								vu.today_water = 0
							}

							if (item.yestoday_water) {
								vu.yestoday_water = parseFloat(item.yestoday_water.toFixed(1))
							} else {
								vu.yestoday_water = 0
							}

							if (item.yestoday_feed) {
								vu.yestoday_feed = parseFloat(item.yestoday_feed.toFixed(1))
							} else {
								vu.yestoday_feed = 0
							}
							if (item.max_feed) {
								vu.max_feed = parseFloat(item.max_feed.toFixed(1))
							} else {
								vu.max_feed = 0
							}


							if (item.max_feed > 0) {
								vu.feed_per = parseFloat(((item.today_feed / item.max_feed) *
									100).toFixed(1))
							} else {
								vu.feed_per = 0
							}


							vu.online_num = item.online_num | 0
							vu.offline_num = item.offline_num | 0
							vu.device_num = item.online_num + item.offline_num


							if (vu.device_num > 0) {
								vu.online_per = parseFloat(((item.online_num / vu.device_num) * 100).toFixed(
									1))
							} else {
								vu.online_per = 0
							}
							console.info(vu.device_num, vu.online_per)

							vu.pig_num = item.pig_num | 0
							vu.pig_num_total = item.pig_num_total | 0
							vu.son_total = item.son_total | 0
							vu.alarm_device_num = item.alarm_device_num | 0
                        }
                    }else{
                        layer.alert(res.msg);
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.msg('加载信息失败');
                },
                complete: function(XMLHttpRequest, textStatus) {
                    layer.closeAll('loading');
                },

            });
        }
        //读取全部参数
        /*function get_all_device_param(addrs){
            ActiveNodeParas=[];
            var f = [];
            for(var i=0;i<addrs.length;i++)
            {
                f.push(get_device_param(addrs[i]));
            }
            var promise = new Promise(function(resolve, reject) {
                Promise.all(f).then(function (arr){
                    console.info(arr);
                    for(var i=0;i<arr.length;i++){
                        if(arr[i].code>=0){
                            var param = arr[i].data;
                            for(var x=0;x<100;x++){
                                var enable = parseInt(param.NodeEn[x]);
                                var row = parseInt(param.NodeParas[x].Row);
                                var col = parseInt(param.NodeParas[x].Col);
                                console.info(row,col);
                                if(row>100 || col>100){
                                    console.info(param)
                                    reject({code:-1,msg:"读取参数错误"});
                                }
                                if(enable>0){
                                    ActiveNodeParas.push(param.NodeParas[x]);
                                    if(max_row < row){
                                        max_row = row;
                                    }
                                    if(max_col < col){
                                        max_col = col;
                                    }
                                }
                            }

                        }else{
                            //读取参数错误
                            reject({code:-1,msg:"读取参数错误"});
                        }
                    }

                    console.info(max_row,max_col);

                    resolve({code:0,msg:"读取参数成功"});
                });
            });
            return promise;

        }*/
        //读取全部状态
        /*function get_all_device_status(addrs){
            ActiveNodeStates=[];
            var f = [];
            for(var i=0;i<addrs.length;i++)
            {
                f.push(get_device_status(addrs[i]));
            }
            var promise = new Promise(function(resolve, reject) {
                Promise.all(f).then(function (arr){
                    console.info(arr);
                    for(var i=0;i<arr.length;i++){
                        if(arr[i].code>=0){
                            var status = arr[i].data;
                            for(var x=0;x<100;x++){
                                var enable = parseInt(status.Enable[x]);
                                var sn = parseInt(status.NodeSN[x]);
                                var online = parseInt(status.Online[x]);
                                var alarmState = parseInt(status.NodeStates[x].AlarmState);
                                var alarmStr = status.NodeStates[x].AlarmStr;
                                if(enable>0){
                                    status.NodeStates[x].sn = sn;//增加sn属性
                                    status.NodeStates[x].online = online;//增加sn属性
                                    status.NodeStates[x].alarmState = alarmState;//增加sn属性
                                    status.NodeStates[x].alarmStr = alarmStr;//增加sn属性
                                    ActiveNodeStates.push(status.NodeStates[x]);
                                }
                            }

                        }else{
                            reject({code:-1,msg:"读取状态错误"});
                        }
                    }

                    resolve({code:0,msg:"读取状态成功"});
                });
            });
            return promise;

        }*/
        //读取参数
        function get_device_param(addr){
            var promise = new Promise(function(resolve, reject) {
                $.ajax({
                    type: 'GET',
                    url: '../Api/Device/HZFGW/Param',
                    data: {addr:addr},
                    beforeSend: function(request) {
                        request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                    },
                    dataType: "json",
                    success: function (res) {
                        if (res && res.code>=0) {
                            resolve(res);
                        }else{
                            toastr.warning(res.msg, "提示");
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        reject(errorThrown);
                    },
                    complete: function(XMLHttpRequest, textStatus) {
                    },
                    dataType: "json"
                });
            });
            return promise;
        }

        //读取全部节点信息
        function get_all_device_node(addrs){
            ActiveNodeParas=[];
            ActiveNodeStates=[];
            var f = [];
            for(var i=0;i<addrs.length;i++)
            {
                f.push(get_device_node(addrs[i]));
            }
            var promise = new Promise(function(resolve, reject) {
                Promise.all(f).then(function (arr){
                    //console.info(arr);
                    for(var i=0;i<arr.length;i++){
                        if(arr[i].code>=0){
                            var nodes = arr[i].data;
                            console.info("nodes",nodes);
                            for(var x=0;x<nodes.length;x++){
                                //var enable = parseInt(param.NodeEn[x]);
                                if(nodes[x].para){
                                    var para = JSON.parse(nodes[x].para);
                                    para.device_type = nodes[x].device_type;//状态拓展设备类型
                                    para.first_online = nodes[x].first_online;
                                    para.version = nodes[x].version;
                                    para.day_use_feed_auto = nodes[x].day_use_feed_auto;
                                    para.day_use_feed_man = nodes[x].day_use_feed_man;
                                    para.day_use_water_auto = nodes[x].day_use_water_auto;
                                    para.day_use_water_man = nodes[x].day_use_water_man;
                                    para.max_feed = nodes[x].max_feed;
                                    para.feed_water = nodes[x].feed_water;
                                    para.feed_plan_id = nodes[x].feed_plan_id;
                                    para.feed_plan_name_new = nodes[x].feed_plan_name_new;
                                    para.day = nodes[x].day;
                                    para.mode = nodes[x].mode;

                                    var row = parseInt(para.Row);
                                    var col = parseInt(para.Col);

                                    //console.info(row,col);
                                    if(row>100 || col>100){
                                        console.info(para)
                                        //reject({code:-1,msg:"读取参数错误"});
                                        continue;
                                    }

                                    ActiveNodeParas.push(para);
                                    if(max_row < row){
                                        max_row = row;
                                    }
                                    if(max_col < col){
                                        max_col = col;
                                    }
                                }


                                if(nodes[x].status){
                                    var status = JSON.parse(nodes[x].status);
                                    status.sn = parseInt(nodes[x].sn);
                                    status.online = parseInt(nodes[x].online);
                                    status.alarm = parseInt(nodes[x].alarm);
                                    status.alarm_ext = parseInt(nodes[x].alarm_ext);
                                    status.device_type = nodes[x].device_type;//状态拓展设备类型
                                    status.first_online = nodes[x].first_online;
                                    status.version = nodes[x].version;
                                    status.day_use_feed_auto = nodes[x].day_use_feed_auto;
                                    status.day_use_feed_man = nodes[x].day_use_feed_man;
                                    status.day_use_water_auto = nodes[x].day_use_water_auto;
                                    status.day_use_water_man = nodes[x].day_use_water_man;
                                    status.max_feed = nodes[x].max_feed;
                                    status.feed_water = nodes[x].feed_water;
                                    status.feed_plan_id = nodes[x].feed_plan_id;
                                    status.feed_plan_name_new = nodes[x].feed_plan_name_new;
                                    status.day = nodes[x].day;
                                    status.mode = nodes[x].mode;

                                    //把耳标/猪种 放到状态显示
                                    //status.earmark = nodes[x].earmark;
                                    //status.pig_type = nodes[x].pig_type;
                                    ActiveNodeStates.push(status);
                                }else{

                                }

                            }



                        }else{
                            //读取参数错误
                            reject({code:-1,msg:"读取节点信息错误"});
                        }
                    }

                    //console.info(max_row,max_col);
                    /*for(var i=0;i<ActiveNodeParas.length;i++){
                        console.info(ActiveNodeParas[i].Hnum,ActiveNodeParas[i].Row,ActiveNodeParas[i].Col);
                    }*/

                    resolve({code:0,msg:"读取节点成功"});
                });
            });
            return promise;
        }

        //读取节点信息
        function get_device_node(addr){
            var promise = new Promise(function(resolve, reject) {
                $.ajax({
                    type: 'GET',
                    url: '../Api/Device/Feednode',
                    data: {addr:addr},
                    beforeSend: function(request) {
                        request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                    },
                    dataType: "json",
                    success: function (res) {
                        if (res && res.code>=0) {
                            resolve(res);
                        }else{
                            toastr.warning(res.msg, "提示");
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        reject(errorThrown);
                    },
                    complete: function(XMLHttpRequest, textStatus) {
                    },
                    dataType: "json"
                });
            });
            return promise;
        }
        //读取状态
        function get_device_status(addr){
            var promise = new Promise(function(resolve, reject) {
                $.ajax({
                    type: 'GET',
                    url: '../Api/Device/HZFGW/Status',
                    data: {addr:addr},
                    beforeSend: function(request) {
                        request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                    },
                    dataType: "json",
                    success: function (res) {
                        if (res && res.code>=0) {
                            resolve(res);
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        reject(errorThrown);
                    },
                    complete: function(XMLHttpRequest, textStatus) {
                    },
                    dataType: "json"
                });
            });
            return promise;
        }

        function get_device(houseid){
            var promise = new Promise(function(resolve, reject) {
                $.ajax({
                    type: 'GET',
                    url: '../Api/Device/ByHouse',
                    data: {houseid:houseid},
                    beforeSend: function(request) {
                        request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                    },
                    dataType: "json",
                    success: function (res) {
                        if (res && res.code>=0) {
                            resolve(res);
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        reject(errorThrown);
                    },
                    complete: function(XMLHttpRequest, textStatus) {
                    },
                    dataType: "json"
                });
            });
            return promise;
        }

        function loadAll(houseid) {
            //loadDeviceData(houseid);
            //loadFeedNodeData(houseid);
            loadSummary(houseid);
            setTimeout(
                function(){
                    loadDaySumFeed(houseid);
                    loadDayAvgFeed(houseid);
                },
            500);
        }

        //废弃
        /*function loadFeedNodeData(houseid){
            $.ajax({
                type: 'GET',
                url: '../Api/Device/Feednode',
                data: {houseid:houseid},
                beforeSend: function(request) {
                    request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                },
                dataType: "json",
                success: function (res) {
                    if(res.code>=0){
                        console.info(res.data);

                        //统计基本
                        var onlineNum = 0;
                        var deviceNum = 0;
                        var offlineNum = 0;
                        var alarmNum = 0;
                        var pigNum = 0;
                        var onlinePer = 0;
                        //离线,堵料,空转,无水料,电机故障,温度高,温度低,其他
                        var alarmNum1= 0,alarmNum2= 0,alarmNum3= 0,alarmNum4= 0,alarmNum5= 0,alarmNum6= 0,alarmNum7= 0,alarmNum8 = 0;
                        var modePigNum = {
                            "停用":0,
                            "妊娠":0,
                            "空怀":0,
                            "保育":0,
                            "育肥":0,
                            "哺乳":0,
                            "公猪":0,
                            "仔":0, //哺乳时候显示带仔数
                        };//模式下猪只个数统计

                        if(res.data){
                            var items = res.data;
                            deviceNum = items.length;
                            for(var i=0;i<items.length;i++)
                            {
                                if(items[i].online==1){
                                    onlineNum += 1;
                                    if(items[i].alarm || items.alarm_ext){
                                        alarmNum+=1;
                                        console.info(i+" 告警");
                                    }
                                }else if(items[i].online==0){
                                    console.info(i+" 离线");
                                    alarmNum+=1;
                                }else{
                                    //从未在线过，不当作离线
                                }


                                //统计大猪个数
                                if(items[i].mode){
                                    pigNum+=1;
                                    modePigNum[decodeMode(items[i].mode)]+=1;
                                    if(items[i].mode==5){
                                        //哺乳
                                        modePigNum["仔"]+=items[i].son;
                                    }
                                }

                                //统计告警
                                if(items[i].alarm){
                                    if(items[i].alarm==1){
                                        alarmNum2+=1;
                                    }else if(items[i].alarm==2){
                                        alarmNum2+=1;
                                    }else if(items[i].alarm==3){
                                        alarmNum8+=1;
                                    }
                                }


                            }
                        }
                        console.info("modePigNum",modePigNum);
                        offlineNum = deviceNum - onlineNum;
                        alarmNum1 = offlineNum;
                        onlinePer = (onlineNum/deviceNum*100).toFixed(1);

                        vu.onlineNum =onlineNum;
                        vu.deviceNum =deviceNum;
                        vu.offlineNum = offlineNum;
                        vu.alarmNum =alarmNum;
                        vu.pigNum = pigNum;
                    }else{
                        layer.alert(res.msg);
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.msg('加载信息失败');
                },
                complete: function(XMLHttpRequest, textStatus) {
                    layer.closeAll('loading');
                },

            });
        }*/

        //废弃
        /*function loadTodayFeed(houseid) {
            //layer.load(1);
            $.ajax({
                type: 'GET',
                url: '../Api/House/TodayFeed',
                data: {id:houseid},
                beforeSend: function(request) {
                    request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                },
                dataType: "json",
                success: function (res) {
                    if(res.code>=0){
                        var feed = parseFloat(res.data.day_use_feed_auto)+parseFloat(res.data.day_use_feed_man);
                        var water = parseFloat(res.data.day_use_water_auto)+parseFloat(res.data.day_use_water_man);
                        vu.todayFeed =feed.toFixed(2);
                    }else{
                        layer.alert(res.msg);
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.msg('加载信息失败');
                },
                complete: function(XMLHttpRequest, textStatus) {
                    layer.closeAll('loading');
                },

            });
        }*/

        function loadDaySumFeed(houseid) {
            //layer.load(1);
            $.ajax({
                type: 'GET',
                url: '../Api/House/DaySumFeed',
                data: {id:houseid,begin:begin,end:end},
                beforeSend: function(request) {
                    request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                },
                dataType: "json",
                success: function (res) {
                    if(res.code>=0){
                        var day_arr =[];
                        var val_arr =[];
                        var val1_arr =[];

                        //console.info(res.data)
                        for(var i=0;i<res.data.length;i++){
                            var his = res.data[i];
                            var feed = parseFloat(his.day_use_feed_auto)+parseFloat(his.day_use_feed_man);
                            var water = parseFloat(his.day_use_water_auto)+parseFloat(his.day_use_water_man);
                            val_arr.push(feed.toFixed(2));
                            val1_arr.push(water.toFixed(2));
                            day_arr.push(moment(his.his_date).format("MM/DD") );
                        }


                        chart2_options.series[0].data= val_arr;
                        chart2_options.series[1].data= val1_arr;
                        chart2_options.xAxis[0].data = day_arr;

                        setTimeout(function(){
                            chart2.setOption(chart2_options);
                        },200);

                    }else{
                        layer.alert(res.msg);
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.msg('加载信息失败');
                },
                complete: function(XMLHttpRequest, textStatus) {
                    layer.closeAll('loading');
                },

            });
        }

        function loadDayAvgFeed(houseid) {
            //layer.load(1);
            $.ajax({
                type: 'GET',
                url: '../Api/House/DaySumFeed',
                data: {id:houseid,begin:begin,end:end},
                beforeSend: function(request) {
                    request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                },
                dataType: "json",
                success: function (res) {
                    if(res.code>=0){

                        var day_arr =[];
                        var val_arr =[];
                        var val1_arr =[];

                        var last_pig_num = 0;
                        if(res.data.length>0){
                            last_pig_num = res.data[res.data.length-1].pig_num; 
                        }
                        for(var i=0;i<res.data.length;i++){
                            var his = res.data[i];
                            var pig_num = his["pig_num"];
                            if(pig_num && pig_num>0){
                                var feed = parseFloat(his.day_use_feed_auto)+parseFloat(his.day_use_feed_man);
                                var water = parseFloat(his.day_use_water_auto)+parseFloat(his.day_use_water_man);
                                val_arr.push((feed/pig_num).toFixed(2));
                                val1_arr.push((water/pig_num).toFixed(2));
                                day_arr.push(moment(his.his_date).format("MM/DD") );
                                last_pig_num = pig_num;
                                console.info("last_pig_num=",last_pig_num)
                            }else{
                                console.info("pig_num缺失，使用last_pig_num",last_pig_num)
                                var feed = parseFloat(his.day_use_feed_auto)+parseFloat(his.day_use_feed_man);
                                var water = parseFloat(his.day_use_water_auto)+parseFloat(his.day_use_water_man);
                                val_arr.push((feed/last_pig_num).toFixed(2));
                                val1_arr.push((water/last_pig_num).toFixed(2));
                                day_arr.push(moment(his.his_date).format("MM/DD") );
                            }
                        }


                        chart1_options.series[0].data= val_arr;
                        chart1_options.series[1].data= val1_arr;
                        chart1_options.xAxis[0].data = day_arr;

                        setTimeout(function(){
                            chart1.setOption(chart1_options);
                        },200);
                    }else{
                        layer.alert(res.msg);
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.msg('加载信息失败');
                },
                complete: function(XMLHttpRequest, textStatus) {
                    layer.closeAll('loading');
                },

            });
        }


        function goFarm(){
            console.info(cur_house);
            window.location.href="../Farm/StatusNew?farmid="+cur_house.farmid;
        }

        function renderSelect(){
            //栏舍下拉
            var html="";
            for(var i=0;i<houses.length;i++){
                var selectd="";
                if(houses[i].id==cur_house.id){
                    selectd=" selected ";
                }
                html+="<option "+selectd+" value=\""+houses[i].id+"\">"+houses[i].housename+"</option>";
            }

            $("select[name='house']").html(html);
            form.render('select');
        }

        window.onresize = function () {
            resize();
        };
        function resize() {
            //字体变化
            const width = document.body.clientWidth;
            const ratio = width / 1920;
            const val = Math.round(16 * ratio);//浏览器默认16px;
            document.documentElement.style.fontSize = val + 'px';

            var h = $(".house-panel").height();

            if (chart1) {
                chart1.resize();
            }
            if (chart2) {
                chart2.resize();
            }
        }

        // 根据不同的屏幕宽度换算字体大小
        function transformFontSize(fontsize) {
            // 获取屏幕宽度
            //const width = window.screen.width
            const width =  document.body.clientWidth ;
            //const ratio = width / 1920
            const ratio = width / 1920
            console.info(width,ratio);
            // 取下整
            return Math.round(fontsize * ratio)
        }


        function beautyTimeSpan(seconds){
            var str ="";
            var day_val=parseInt(seconds/(60*60*24)) ;
            var rest=seconds % (60*60*24);
            var hour_val= parseInt(rest/(60*60));
            rest=seconds % (60*60);
            var minite_val= parseInt(rest/(60));
            rest=seconds % (60);

            if(day_val>0){
                str+=(day_val + "天")
            }
            if(hour_val>0){
                str+=(hour_val + "时")
            }
            if(minite_val>0){
                str+=(minite_val + "分")
            }
            if(rest>0){
                str+=(rest + "秒")
            }

            return str
        }

        function formatminutes(date){
            $($(".laydate-time-list li ol")[2]).find("li").remove(); //清空秒
        }

    </script>
<script src="../js/check_screen.js?v=${.Config.basic.version}"></script>

</body>

<div id="detail" style="display:none;">

    <div class=" layui-tab layui-tab-brief"  style="">
        <ul class="layui-tab-title">
            <li class="layui-this"><i class="layui-icon layui-icon-note "></i> 概要信息 </li>
            <li><i class="layui-icon layui-icon-cart-simple "></i> 饲喂方案 </li>
            <li><i class="layui-icon layui-icon-list "></i> 采食详情</li>
            <li><i class="layui-icon layui-icon-notice "></i> 设备报警</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <div class="">
                    <div style="margin: 5px;padding: 5px;">

                        <span id="title_online" class="layui-badge layui-bg-green">在线</span>
                        <span id="title_offline" class="layui-badge layui-bg-black">离线</span>
                        <span id="title_disable" class="layui-badge layui-bg-orange">停用</span>
                        <span id="title_alarm" class="layui-badge layui-bg-red"></span>
                        <span id="title_sn" class="layui-badge layui-bg-black"></span>
                        <span id="title_ver" class="layui-badge layui-bg-black"></span>
                        
                        <!-- <span id="title_dura" class="layui-badge layui-bg-black"></span> -->
                    </div>
                    <form class="layui-form" id="form_status" lay-filter="form_status" >

                        <div class="layui-form-item layui-form-item-ext">
                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">今日下料</label>
                                <div class="layui-input-inline" style="padding: 9px 15px;">
                                    <div style="width: 310px;" class="layui-progress layui-progress-big" lay-showpercent="true" lay-filter="progress1">
                                        <div class="layui-progress-bar layui-bg-blue" lay-percent="0%"></div>
                                    </div>
                                </div>
                            </div>
                        </div>


                        <!-- <div class="layui-form-item layui-form-item-ext">
                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">耳标号</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="earmark" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>

                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">猪种</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="pig_type" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>
                        </div> -->

                        <div class="layui-form-item layui-form-item-ext">
                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">日龄</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="Gday" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>

                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">模式</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="ModeDesc" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-item-ext">
                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">料水比</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="FeedWater" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">日下料目标</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="MaxFeed" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>
                        </div>



                        <!--<div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">时段下料</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="OutT" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-inline">
                                <label class="layui-form-label">时段已下</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="TimeUseFeed" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>-->

                        <div class="layui-form-item layui-form-item-ext">
                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">自动下水</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="DayUseWaterAuto" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>

                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">自动下料</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="DayUseFeedAuto" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-item-ext">
                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">手动下水</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="DayUseWaterMan" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>

                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">手动下料</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="DayUseFeedMan" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
            <div class="layui-tab-item ">
                <div class="">
                    <div class="layui-btn-group plan_btns" style="margin-top: 5px;">
                        <button class="layui-btn layui-btn-sm" style="background-color: #4958b9;" data-type="set" data-key="anim" data-value="plan_time">时间表</button>
                        <button class="layui-btn layui-btn-sm " data-type="set" data-key="anim" data-value="plan_curve">饲喂曲线</button>
                    </div>
                    <div class="plan_time div_plan">
                        <table class="layui-hide" id="table_time1" lay-filter="table_time1"></table>
                    </div>
                    <div class="plan_curve div_plan layui-hide">
                        <table class="layui-hide" id="table_curve1" lay-filter="table_curve1"></table>
                    </div>
                </div>
                <!--<div class="detail-tab-scroll">
                    <blockquote class="layui-elem-quote" style="font-size: 0.8em;line-height: 2px;"> 时间表</blockquote>
                    <table class="layui-hide" id="table_time1" lay-filter="table_time1"></table>
                    <blockquote class="layui-elem-quote" style="font-size: 0.8em;line-height: 2px;"> 饲喂曲线</blockquote>
                    <table class="layui-hide" id="table_curve1" lay-filter="table_curve1"></table>
                </div>-->

            </div>
            <div class="layui-tab-item ">
                <div class="">
                    <div class="layui-btn-group history_btns" style="margin-top: 5px;">
                        <button class="layui-btn layui-btn-sm" style="background-color: #4958b9;" data-type="set" data-key="anim" data-value="feed_his">下料记录</button>
                        <button class="layui-btn layui-btn-sm " data-type="set" data-key="anim" data-value="water_his">下水记录</button>
                        <button class="layui-btn layui-btn-sm " data-type="set" data-key="anim" data-value="tb_his">触碰记录</button>
                    </div>
                    <div class="feed_his div_his">
                        <table class="layui-hide" id="table_feed_his" lay-filter="table_feed_his"></table>
                    </div>
                    <div class="water_his div_his layui-hide">
                        <table class="layui-hide" id="table_water_his" lay-filter="table_water_his"></table>
                    </div>
                    <div class="tb_his div_his layui-hide">
                        <table class="layui-hide" id="table_tb_his" lay-filter="table_tb_his"></table>
                    </div>
                </div>
            </div>
            <div class="layui-tab-item ">
                <div class="">
                    <div class="layui-btn-group alarm_btns" style="margin-top: 5px;">
                        <button class="layui-btn layui-btn-sm" style="background-color: #4958b9;" data-type="set" data-key="anim" data-value="alarm_now">当前告警</button>
                        <button class="layui-btn layui-btn-sm " data-type="set" data-key="anim" data-value="alarm_his">告警历史</button>
                    </div>
                    <div class="alarm_now div_alarm">
                        <table class="layui-hide" id="table_alarm_now" lay-filter="table_alarm_now"></table>
                    </div>
                    <div class="alarm_his div_alarm layui-hide">
                        <table class="layui-hide" id="table_alarm_his" lay-filter="table_alarm_his"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>

<div id="detail_new" style="display:none;">

    <div class=" layui-tab layui-tab-brief"  style="">
        <ul class="layui-tab-title">
            <li class="layui-this"><i class="layui-icon layui-icon-note "></i> 概要信息 </li>
            
            <li><i class="layui-icon layui-icon-list "></i> 采食详情</li>
            <li><i class="layui-icon layui-icon-notice "></i> 设备报警</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <div class="">
                    <div style="margin: 5px;padding: 5px;">

                        <span id="title_online_new" class="layui-badge layui-bg-green">在线</span>
                        <span id="title_offline_new" class="layui-badge layui-bg-black">离线</span>
                        <span id="title_disable_new" class="layui-badge layui-bg-orange">停用</span>
                        <span id="title_alarm_new" class="layui-badge layui-bg-red"></span>
                        <span id="title_sn_new" class="layui-badge layui-bg-black"></span>
                        <span id="title_ver_new" class="layui-badge layui-bg-black"></span>
                        
                        <span id="title_dura_new" class="layui-badge layui-bg-black"></span>
                    </div>
                    <form class="layui-form" id="form_status_new" lay-filter="form_status_new" >

                        <div class="layui-form-item layui-form-item-ext">
                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">今日下料</label>
                                <div class="layui-input-inline" style="padding: 9px 15px;">
                                    <div style="width: 310px;" class="layui-progress layui-progress-big" lay-showpercent="true" lay-filter="progress1">
                                        <div class="layui-progress-bar layui-bg-blue" lay-percent="0%"></div>
                                    </div>
                                </div>
                            </div>
                        </div>


                        

                        <div class="layui-form-item layui-form-item-ext">
                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">日龄</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="day" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>

                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">模式</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="mode" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-item-ext">
                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">料水比</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="feed_water" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">日下料目标</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="max_feed" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>
                        </div>



                        <!--<div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">时段下料</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="OutT" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-inline">
                                <label class="layui-form-label">时段已下</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="TimeUseFeed" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>-->

                        <div class="layui-form-item layui-form-item-ext">
                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">自动下水</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="day_use_water_auto" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>

                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">自动下料</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="day_use_feed_auto" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-item-ext">
                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">手动下水</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="day_use_water_man" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>

                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">手动下料</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="day_use_feed_man" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-item-ext">
                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-label-ext-sm">其他信息</label>
                                <div class="layui-input-inline">
                                    <input type="text" readonly  name="other" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input layui-input-ext">
                                </div>
                            </div>

                            
                        </div>

                    </form>
                </div>
            </div>
           
            <div class="layui-tab-item ">
                <div class="">
                    <div class="layui-btn-group history_btns" style="margin-top: 5px;">
                        <button class="layui-btn layui-btn-sm" style="background-color: #4958b9;" data-type="set" data-key="anim" data-value="feed_his">下料记录</button>
                        <button class="layui-btn layui-btn-sm " data-type="set" data-key="anim" data-value="water_his">下水记录</button>
                        <button class="layui-btn layui-btn-sm " data-type="set" data-key="anim" data-value="tb_his">触碰记录</button>
                    </div>
                    <div class="feed_his div_his">
                        <table class="layui-hide" id="table_feed_his_new" lay-filter="table_feed_his"></table>
                    </div>
                    <div class="water_his div_his layui-hide">
                        <table class="layui-hide" id="table_water_his_new" lay-filter="table_water_his"></table>
                    </div>
                    <div class="tb_his div_his layui-hide">
                        <table class="layui-hide" id="table_tb_his_new" lay-filter="table_tb_his"></table>
                    </div>
                </div>
            </div>
            <div class="layui-tab-item ">
                <div class="">
                    <div class="layui-btn-group alarm_btns" style="margin-top: 5px;">
                        <button class="layui-btn layui-btn-sm" style="background-color: #4958b9;" data-type="set" data-key="anim" data-value="alarm_now">当前告警</button>
                        <button class="layui-btn layui-btn-sm " data-type="set" data-key="anim" data-value="alarm_his">告警历史</button>
                    </div>
                    <div class="alarm_now div_alarm">
                        <table class="layui-hide" id="table_alarm_now_new" lay-filter="table_alarm_now"></table>
                    </div>
                    <div class="alarm_his div_alarm layui-hide">
                        <table class="layui-hide" id="table_alarm_his_new" lay-filter="table_alarm_his"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>

</html>